1 /* 2 * hunt-amqp-client: AMQP Client Library for D Programming Language. Support for RabbitMQ and other AMQP Server. 3 * 4 * Copyright (C) 2018-2019 HuntLabs 5 * 6 * Website: https://www.huntlabs.net 7 * 8 * Licensed under the Apache-2.0 License. 9 * 10 */ 11 module hunt.amqp.client.AmqpMessageBuilder; 12 13 import hunt.amqp.client.impl.AmqpMessageBuilderImpl; 14 import hunt.amqp.client.AmqpMessage; 15 //import hunt.codegen.annotations.GenIgnore; 16 //import hunt.codegen.annotations.VertxGen; 17 //import hunt.core.buffer.Buffer; 18 //import hunt.core.json.JsonArray; 19 //import hunt.core.json.JsonObject; 20 21 //import java.time.Instant; 22 import hunt.collection.List; 23 import hunt.collection.Map; 24 //import hunt.collection.UUID; 25 26 /** 27 * Builder to create a new {@link AmqpMessage}. 28 * <p> 29 * Reference about the different metadata can be found on 30 * <a href="http://docs.oasis-open.org/amqp/core/v1.0/amqp-core-messaging-v1.0.html#type-properties">AMQP message properties</a>. 31 * <p> 32 * Note that the body is set using {@code withBodyAs*} method depending on the passed type. 33 */ 34 interface AmqpMessageBuilder { 35 36 /** 37 * @return a new instance of {@link AmqpMessageBuilder} 38 */ 39 static AmqpMessageBuilder create() { 40 return new AmqpMessageBuilderImpl(); 41 } 42 43 /** 44 * @return the message. 45 */ 46 AmqpMessage build(); 47 48 // Headers 49 50 AmqpMessageBuilder priority(short priority); 51 52 AmqpMessageBuilder durable(bool durable); 53 54 AmqpMessageBuilder ttl(long ttl); 55 56 AmqpMessageBuilder firstAcquirer(bool first); 57 58 AmqpMessageBuilder deliveryCount(int count); 59 60 // Properties 61 62 AmqpMessageBuilder id(string id); 63 64 AmqpMessageBuilder address(string address); 65 66 AmqpMessageBuilder replyTo(string replyTo); 67 68 AmqpMessageBuilder correlationId(string correlationId); 69 70 AmqpMessageBuilder withBody(string value); 71 72 AmqpMessageBuilder withSymbolAsBody(string value); 73 74 AmqpMessageBuilder subject(string subject); 75 76 AmqpMessageBuilder contentType(string ct); 77 78 AmqpMessageBuilder contentEncoding(string ct); 79 80 AmqpMessageBuilder expiryTime(long expiry); 81 82 AmqpMessageBuilder creationTime(long ct); 83 84 AmqpMessageBuilder groupId(string gi); 85 86 AmqpMessageBuilder replyToGroupId(string rt); 87 88 //AmqpMessageBuilder applicationProperties(JsonObject props); 89 90 AmqpMessageBuilder withBooleanAsBody(bool v); 91 92 AmqpMessageBuilder withByteAsBody(byte v); 93 94 AmqpMessageBuilder withShortAsBody(short v); 95 96 AmqpMessageBuilder withIntegerAsBody(int v); 97 98 AmqpMessageBuilder withLongAsBody(long v); 99 100 AmqpMessageBuilder withFloatAsBody(float v); 101 102 AmqpMessageBuilder withDoubleAsBody(double v); 103 104 AmqpMessageBuilder withCharAsBody(char c); 105 106 // @GenIgnore(GenIgnore.PERMITTED_TYPE) 107 // AmqpMessageBuilder withInstantAsBody(Instant v); 108 109 // @GenIgnore(GenIgnore.PERMITTED_TYPE) 110 // AmqpMessageBuilder withUuidAsBody(UUID v); 111 //// 112 // // @GenIgnore 113 // AmqpMessageBuilder withListAsBody(List list); 114 // 115 //// @GenIgnore 116 // AmqpMessageBuilder withMapAsBody(Map map); 117 118 //AmqpMessageBuilder withBufferAsBody(Buffer buffer); 119 // 120 //AmqpMessageBuilder withJsonObjectAsBody(JsonObject json); 121 // 122 //AmqpMessageBuilder withJsonArrayAsBody(JsonArray json); 123 }