Class ClientStreamReceiverMessage
- java.lang.Object
-
- org.apache.qpid.protonj2.client.impl.ClientStreamReceiverMessage
-
- All Implemented Interfaces:
AdvancedMessage<InputStream>
,Message<InputStream>
,StreamReceiverMessage
public final class ClientStreamReceiverMessage extends Object implements StreamReceiverMessage
Streamed message delivery context used to request reads of possible split framedTransfer
payload's that comprise a single large overall message.
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
aborted()
Check if theStreamDelivery
that was assigned to thisStreamReceiverMessage
has been marked as aborted by the remote.long
absoluteExpiryTime()
StreamReceiverMessage
absoluteExpiryTime(long expiryTime)
Sets the absolute expiration time value to assign to thisMessage
.StreamReceiverMessage
addBodySection(Section<?> bodySection)
Adds the givenSection
to the internal collection of sections that will be sent to the remote peer when this message is encoded.Object
annotation(String key)
Returns the requested message annotation value from thisMessage
if it exists or returns null otherwise.StreamReceiverMessage
annotation(String key, Object value)
Sets the given message annotation value at the given key, replacing any previous value that was assigned to thisMessage
.MessageAnnotations
annotations()
Return the currentMessageAnnotations
assigned to this message, if none was assigned yet then this method returnsnull
.StreamReceiverMessage
annotations(MessageAnnotations messageAnnotations)
Assign or replace theMessageAnnotations
instance associated with this message.ApplicationProperties
applicationProperties()
Return the currentApplicationProperties
assigned to this message, if none was assigned yet then this method returnsnull
.StreamReceiverMessage
applicationProperties(ApplicationProperties applicationProperties)
Assign or replace theApplicationProperties
instance associated with this message.InputStream
body()
Returns the body value that is conveyed in this message or null if no body was set locally or sent from the remote if this is an incoming message.StreamReceiverMessage
body(InputStream value)
Sets the body value that is to be conveyed to the remote when this message is sent.Collection<Section<?>>
bodySections()
Create and return an unmodifiableCollection
that contains theSection
instances currently assigned to this message.StreamReceiverMessage
bodySections(Collection<Section<?>> sections)
Sets the bodySection
instances to use when encoding this message.StreamReceiverMessage
clearBodySections()
Clears all current bodySection
elements from theAdvancedMessage
.boolean
completed()
Check if theStreamDelivery
that was assigned to thisStreamReceiverMessage
has been marked as complete by the remote.String
contentEncoding()
Message<?>
contentEncoding(String contentEncoding)
Sets the contentEncoding value to assign to thisMessage
.String
contentType()
StreamReceiverMessage
contentType(String contentType)
Sets the contentType value to assign to thisMessage
.Object
correlationId()
StreamReceiverMessage
correlationId(Object correlationId)
Sets the correlationId value to assign to thisMessage
.long
creationTime()
StreamReceiverMessage
creationTime(long createTime)
Sets the creation time value to assign to thisMessage
.ClientStreamDelivery
delivery()
long
deliveryCount()
StreamReceiverMessage
deliveryCount(long deliveryCount)
Sets the value to assign to the delivery count field of thisMessage
.boolean
durable()
For an message being sent this method returns the current state of the durable flag on the message.StreamReceiverMessage
durable(boolean durable)
Controls if the message is marked as durable when sent.ProtonBuffer
encode(Map<String,Object> deliveryAnnotations)
Encodes theAdvancedMessage
for transmission by the client.boolean
firstAcquirer()
StreamReceiverMessage
firstAcquirer(boolean firstAcquirer)
Sets the value to assign to the first acquirer field of thisMessage
.Footer
footer()
Return the currentFooter
assigned to this message, if none was assigned yet then this method returnsnull
.Object
footer(String key)
Returns the requested footer value from thisMessage
if it exists or returnsnull
otherwise.StreamReceiverMessage
footer(String key, Object value)
Sets the given footer value at the given key, replacing any previous value that was assigned to thisMessage
.StreamReceiverMessage
footer(Footer footer)
Assign or replace theFooter
instance associated with this message.StreamReceiverMessage
forEachAnnotation(BiConsumer<String,Object> action)
Invokes the givenBiConsumer
on each message annotation entry carried in thisMessage
.StreamReceiverMessage
forEachBodySection(Consumer<Section<?>> consumer)
Performs the given action for each bodySection
of theAdvancedMessage
until all sections have been presented to the givenConsumer
or the consumer throws an exception.StreamReceiverMessage
forEachFooter(BiConsumer<String,Object> action)
Invokes the givenBiConsumer
on each footer entry carried in thisMessage
.StreamReceiverMessage
forEachProperty(BiConsumer<String,Object> action)
Invokes the givenBiConsumer
on each application property entry carried in thisMessage
.String
groupId()
StreamReceiverMessage
groupId(String groupId)
Sets the groupId value to assign to thisMessage
.int
groupSequence()
StreamReceiverMessage
groupSequence(int groupSequence)
Sets the group sequence value to assign to thisMessage
.boolean
hasAnnotation(String key)
Query theMessage
to determine if it carries the given message annotation key.boolean
hasAnnotations()
Query theMessage
to determine if it carries any message annotations.boolean
hasFooter(String key)
Query theMessage
to determine if it carries the given footer key.boolean
hasFooters()
Query theMessage
to determine if it carries any footers.boolean
hasProperties()
Query theMessage
to determine if it carries any application properties.boolean
hasProperty(String key)
Query theMessage
to determine if it carries the given application property key.Header
header()
Return the currentHeader
assigned to this message, if none was assigned yet then this method returnsnull
.StreamReceiverMessage
header(Header header)
Assign or replace theHeader
instance associated with this message.int
messageFormat()
StreamReceiverMessage
messageFormat(int messageFormat)
Sets the message format to use when the message is sent.Object
messageId()
StreamReceiverMessage
messageId(Object messageId)
Sets the message Id value to assign to thisMessage
.byte
priority()
StreamReceiverMessage
priority(byte priority)
Sets the relative message priority.Properties
properties()
Return the currentProperties
assigned to this message, if none was assigned yet then this method returnsnull
.StreamReceiverMessage
properties(Properties properties)
Assign or replace theProperties
instance associated with this message.Object
property(String key)
Returns the requested application property value from thisMessage
if it exists or returns null otherwise.StreamReceiverMessage
property(String key, Object value)
Sets the given application property value at the given key, replacing any previous value that was assigned to thisMessage
.ClientStreamReceiver
receiver()
Object
removeAnnotation(String key)
Removes the given message annotation from the values carried in the message currently, if none was present than this method returnsnull
.Object
removeFooter(String key)
Removes the given footer from the values carried in the message currently, if none was present than this method returnsnull
.Object
removeProperty(String key)
Removes the given application property from the values carried in the message currently, if none was present than this method returnsnull
.String
replyTo()
StreamReceiverMessage
replyTo(String replyTo)
Sets the replyTo value to assign to thisMessage
.String
replyToGroupId()
StreamReceiverMessage
replyToGroupId(String replyToGroupId)
Sets the replyTo group Id value to assign to thisMessage
.String
subject()
StreamReceiverMessage
subject(String subject)
Sets the subject value to assign to thisMessage
.long
timeToLive()
StreamReceiverMessage
timeToLive(long timeToLive)
Sets the message time to live value.String
to()
StreamReceiverMessage
to(String to)
Sets the 'to' value to assign to thisMessage
.byte[]
userId()
StreamReceiverMessage
userId(byte[] userId)
Sets the user Id value to assign to thisMessage
.-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.apache.qpid.protonj2.client.Message
toAdvancedMessage
-
-
-
-
Method Detail
-
receiver
public ClientStreamReceiver receiver()
- Specified by:
receiver
in interfaceStreamReceiverMessage
- Returns:
- the
StreamReceiver
that this context was create under.
-
delivery
public ClientStreamDelivery delivery()
- Specified by:
delivery
in interfaceStreamReceiverMessage
- Returns:
- the
StreamDelivery
that is associated with the life-cycle of thisStreamReceiverMessage
-
aborted
public boolean aborted()
Description copied from interface:StreamReceiverMessage
Check if theStreamDelivery
that was assigned to thisStreamReceiverMessage
has been marked as aborted by the remote.- Specified by:
aborted
in interfaceStreamReceiverMessage
- Returns:
- true if this context has been marked as aborted previously.
-
completed
public boolean completed()
Description copied from interface:StreamReceiverMessage
Check if theStreamDelivery
that was assigned to thisStreamReceiverMessage
has been marked as complete by the remote.- Specified by:
completed
in interfaceStreamReceiverMessage
- Returns:
- true if this context has been marked as being the complete.
-
messageFormat
public int messageFormat() throws ClientException
- Specified by:
messageFormat
in interfaceAdvancedMessage<InputStream>
- Returns:
- the currently assigned message format for this message.
- Throws:
ClientException
- if an error occurs while retrieving the message data.
-
messageFormat
public StreamReceiverMessage messageFormat(int messageFormat) throws ClientUnsupportedOperationException
Description copied from interface:AdvancedMessage
Sets the message format to use when the message is sent. The exact structure of a message, together with its encoding, is defined by the message format (default is the AMQP defined message format zero.This field MUST be specified for the first transfer of a multi-transfer message, if it is not set at the time of send of the first transfer the sender uses the AMQP default value of zero for this field.
The upper three octets of a message format code identify a particular message format. The lowest octet indicates the version of said message format. Any given version of a format is forwards compatible with all higher versions.
3 octets 1 octet +----------------+---------+ | message format | version | +----------------+---------+ | | msb lsb
- Specified by:
messageFormat
in interfaceAdvancedMessage<InputStream>
- Parameters:
messageFormat
- The message format to encode into the transfer frame that carries the message.- Returns:
- this
AdvancedMessage
instance. - Throws:
ClientUnsupportedOperationException
-
durable
public boolean durable() throws ClientException
Description copied from interface:Message
For an message being sent this method returns the current state of the durable flag on the message. For a received message this method returns the durable flag value at the time of sending (or false if not set) unless the value is updated after being received by the receiver.- Specified by:
durable
in interfaceMessage<InputStream>
- Returns:
- true if the Message is marked as being durable
- Throws:
ClientException
- if an error occurs while reading the given value.
-
durable
public StreamReceiverMessage durable(boolean durable) throws ClientUnsupportedOperationException
Description copied from interface:Message
Controls if the message is marked as durable when sent.- Specified by:
durable
in interfaceMessage<InputStream>
- Parameters:
durable
- value assigned to the durable flag for this message.- Returns:
- this
Message
instance. - Throws:
ClientUnsupportedOperationException
-
priority
public byte priority() throws ClientException
- Specified by:
priority
in interfaceMessage<InputStream>
- Returns:
- the currently configured priority or the default if none set.
- Throws:
ClientException
- if an error occurs while reading the given value.
-
priority
public StreamReceiverMessage priority(byte priority) throws ClientUnsupportedOperationException
Description copied from interface:Message
Sets the relative message priority. Higher numbers indicate higher priority messages. Messages with higher priorities MAY be delivered before those with lower priorities. For a received message this overwrites any value that was set by the remote sender.- Specified by:
priority
in interfaceMessage<InputStream>
- Parameters:
priority
- The priority value to assign this message.- Returns:
- this
Message
instance. - Throws:
ClientUnsupportedOperationException
-
timeToLive
public long timeToLive() throws ClientException
- Specified by:
timeToLive
in interfaceMessage<InputStream>
- Returns:
- the currently set Time To Live duration (milliseconds).
- Throws:
ClientException
- if an error occurs while reading the given value.
-
timeToLive
public StreamReceiverMessage timeToLive(long timeToLive) throws ClientUnsupportedOperationException
Description copied from interface:Message
Sets the message time to live value.The time to live duration in milliseconds for which the message is to be considered "live". If this is set then a message expiration time will be computed based on the time of arrival at an intermediary. Messages that live longer than their expiration time will be discarded (or dead lettered). When a message is transmitted by an intermediary that was received with a time to live, the transmitted message's header SHOULD contain a time to live that is computed as the difference between the current time and the formerly computed message expiration time, i.e., the reduced time to live, so that messages will eventually die if they end up in a delivery loop.
- Specified by:
timeToLive
in interfaceMessage<InputStream>
- Parameters:
timeToLive
- The time span in milliseconds that this message should remain live before being discarded.- Returns:
- this
Message
instance. - Throws:
ClientUnsupportedOperationException
-
firstAcquirer
public boolean firstAcquirer() throws ClientException
- Specified by:
firstAcquirer
in interfaceMessage<InputStream>
- Returns:
- if this message has been acquired by another link previously
- Throws:
ClientException
- if an error occurs while reading the given value.
-
firstAcquirer
public StreamReceiverMessage firstAcquirer(boolean firstAcquirer) throws ClientUnsupportedOperationException
Description copied from interface:Message
Sets the value to assign to the first acquirer field of thisMessage
.If this value is true, then this message has not been acquired by any other link. If this value is false, then this message MAY have previously been acquired by another link or links.
- Specified by:
firstAcquirer
in interfaceMessage<InputStream>
- Parameters:
firstAcquirer
- The boolean value to assign to the first acquirer field of the message.- Returns:
- this
Message
instance. - Throws:
ClientUnsupportedOperationException
-
deliveryCount
public long deliveryCount() throws ClientException
- Specified by:
deliveryCount
in interfaceMessage<InputStream>
- Returns:
- the number of failed delivery attempts that this message has been part of.
- Throws:
ClientException
- if an error occurs while reading the given value.
-
deliveryCount
public StreamReceiverMessage deliveryCount(long deliveryCount) throws ClientUnsupportedOperationException
Description copied from interface:Message
Sets the value to assign to the delivery count field of thisMessage
.Delivery count is the number of unsuccessful previous attempts to deliver this message. If this value is non-zero it can be taken as an indication that the delivery might be a duplicate. On first delivery, the value is zero. It is incremented upon an outcome being settled at the sender, according to rules defined for each outcome.
- Specified by:
deliveryCount
in interfaceMessage<InputStream>
- Parameters:
deliveryCount
- The new delivery count value to assign to this message.- Returns:
- this
Message
instance. - Throws:
ClientUnsupportedOperationException
-
header
public Header header() throws ClientException
Description copied from interface:AdvancedMessage
Return the currentHeader
assigned to this message, if none was assigned yet then this method returnsnull
.- Specified by:
header
in interfaceAdvancedMessage<InputStream>
- Returns:
- the currently assigned
Header
for this message. - Throws:
ClientException
- if an error occurs while retrieving the message data.
-
header
public StreamReceiverMessage header(Header header) throws ClientUnsupportedOperationException
Description copied from interface:AdvancedMessage
Assign or replace theHeader
instance associated with this message.- Specified by:
header
in interfaceAdvancedMessage<InputStream>
- Parameters:
header
- TheHeader
value to assign to this message.- Returns:
- this
AdvancedMessage
instance. - Throws:
ClientUnsupportedOperationException
-
messageId
public Object messageId() throws ClientException
- Specified by:
messageId
in interfaceMessage<InputStream>
- Returns:
- the currently set Message ID or null if none set.
- Throws:
ClientException
- if an error occurs while reading the given value.
-
messageId
public StreamReceiverMessage messageId(Object messageId) throws ClientUnsupportedOperationException
Description copied from interface:Message
Sets the message Id value to assign to thisMessage
.The message Id, if set, uniquely identifies a message within the message system. The message producer is usually responsible for setting the message-id in such a way that it is assured to be globally unique. A remote peer MAY discard a message as a duplicate if the value of the message-id matches that of a previously received message sent to the same node.
- Specified by:
messageId
in interfaceMessage<InputStream>
- Parameters:
messageId
- The message Id value to assign to thisMessage
instance.- Returns:
- this
Message
instance. - Throws:
ClientUnsupportedOperationException
-
userId
public byte[] userId() throws ClientException
- Specified by:
userId
in interfaceMessage<InputStream>
- Returns:
- the currently set User ID or null if none set.
- Throws:
ClientException
- if an error occurs while reading the given value.
-
userId
public StreamReceiverMessage userId(byte[] userId) throws ClientUnsupportedOperationException
Description copied from interface:Message
Sets the user Id value to assign to thisMessage
.The identity of the user responsible for producing the message. The client sets this value, and it MAY be authenticated by intermediaries.
- Specified by:
userId
in interfaceMessage<InputStream>
- Parameters:
userId
- The user Id value to assign to thisMessage
instance.- Returns:
- this
Message
instance. - Throws:
ClientUnsupportedOperationException
-
to
public String to() throws ClientException
- Specified by:
to
in interfaceMessage<InputStream>
- Returns:
- the currently set 'To' address which indicates the intended destination of the message.
- Throws:
ClientException
- if an error occurs while reading the given value.
-
to
public StreamReceiverMessage to(String to) throws ClientUnsupportedOperationException
Description copied from interface:Message
Sets the 'to' value to assign to thisMessage
.The to field identifies the node that is the intended destination of the message. On any given transfer this might not be the node at the receiving end of the link.
- Specified by:
to
in interfaceMessage<InputStream>
- Parameters:
to
- The 'to' node value to assign to thisMessage
instance.- Returns:
- this
Message
instance. - Throws:
ClientUnsupportedOperationException
-
subject
public String subject() throws ClientException
- Specified by:
subject
in interfaceMessage<InputStream>
- Returns:
- the currently set subject metadata for this message or null if none set.
- Throws:
ClientException
- if an error occurs while reading the given value.
-
subject
public StreamReceiverMessage subject(String subject) throws ClientUnsupportedOperationException
Description copied from interface:Message
Sets the subject value to assign to thisMessage
.A common field for summary information about the message content and purpose.
- Specified by:
subject
in interfaceMessage<InputStream>
- Parameters:
subject
- The subject node value to assign to thisMessage
instance.- Returns:
- this
Message
instance. - Throws:
ClientUnsupportedOperationException
-
replyTo
public String replyTo() throws ClientException
- Specified by:
replyTo
in interfaceMessage<InputStream>
- Returns:
- the configured address of the node where replies to this message should be sent, or null if not set.
- Throws:
ClientException
- if an error occurs while reading the given value.
-
replyTo
public StreamReceiverMessage replyTo(String replyTo) throws ClientUnsupportedOperationException
Description copied from interface:Message
Sets the replyTo value to assign to thisMessage
.The address of the node to send replies to.
- Specified by:
replyTo
in interfaceMessage<InputStream>
- Parameters:
replyTo
- The replyTo node value to assign to thisMessage
instance.- Returns:
- this
Message
instance. - Throws:
ClientUnsupportedOperationException
-
correlationId
public Object correlationId() throws ClientException
- Specified by:
correlationId
in interfaceMessage<InputStream>
- Returns:
- the currently assigned correlation ID or null if none set.
- Throws:
ClientException
- if an error occurs while reading the given value.
-
correlationId
public StreamReceiverMessage correlationId(Object correlationId) throws ClientUnsupportedOperationException
Description copied from interface:Message
Sets the correlationId value to assign to thisMessage
.This is a client-specific id that can be used to mark or identify messages between clients.
- Specified by:
correlationId
in interfaceMessage<InputStream>
- Parameters:
correlationId
- The correlationId value to assign to thisMessage
instance.- Returns:
- this
Message
instance. - Throws:
ClientUnsupportedOperationException
-
contentType
public String contentType() throws ClientException
- Specified by:
contentType
in interfaceMessage<InputStream>
- Returns:
- the assigned content type value for the message body section or null if not set.
- Throws:
ClientException
- if an error occurs while reading the given value.
-
contentType
public StreamReceiverMessage contentType(String contentType) throws ClientUnsupportedOperationException
Description copied from interface:Message
Sets the contentType value to assign to thisMessage
.The RFC-2046 MIME type for the message's application-data section (body). As per RFC-2046 this can contain a charset parameter defining the character encoding used: e.g., 'text/plain; charset="utf-8"'.
For clarity, as per section 7.2.1 of RFC-2616, where the content type is unknown the content-type SHOULD NOT be set. This allows the recipient the opportunity to determine the actual type. Where the section is known to be truly opaque binary data, the content-type SHOULD be set to application/octet-stream.
When using an application-data section with a section code other than data, content-type SHOULD NOT be set.
- Specified by:
contentType
in interfaceMessage<InputStream>
- Parameters:
contentType
- The contentType value to assign to thisMessage
instance.- Returns:
- this
Message
instance. - Throws:
ClientUnsupportedOperationException
-
contentEncoding
public String contentEncoding() throws ClientException
- Specified by:
contentEncoding
in interfaceMessage<InputStream>
- Returns:
- the assigned content encoding value for the message body section or null if not set.
- Throws:
ClientException
- if an error occurs while reading the given value.
-
contentEncoding
public Message<?> contentEncoding(String contentEncoding) throws ClientUnsupportedOperationException
Description copied from interface:Message
Sets the contentEncoding value to assign to thisMessage
.The content-encoding property is used as a modifier to the content-type. When present, its value indicates what additional content encodings have been applied to the application-data, and thus what decoding mechanisms need to be applied in order to obtain the media-type referenced by the content-type header field.
Content-encoding is primarily used to allow a document to be compressed without losing the identity of its underlying content type.
Content-encodings are to be interpreted as per section 3.5 of RFC 2616 [RFC2616]. Valid content-encodings are registered at IANA [IANAHTTPPARAMS].
The content-encoding MUST NOT be set when the application-data section is other than data. The binary representation of all other application-data section types is defined completely in terms of the AMQP type system.
Implementations MUST NOT use the identity encoding. Instead, implementations SHOULD NOT set this property. Implementations SHOULD NOT use the compress encoding, except as to remain compatible with messages originally sent with other protocols, e.g. HTTP or SMTP.
Implementations SHOULD NOT specify multiple content-encoding values except as to be compatible with messages originally sent with other protocols, e.g. HTTP or SMTP.
- Specified by:
contentEncoding
in interfaceMessage<InputStream>
- Parameters:
contentEncoding
- The contentEncoding value to assign to thisMessage
instance.- Returns:
- this
Message
instance. - Throws:
ClientUnsupportedOperationException
-
absoluteExpiryTime
public long absoluteExpiryTime() throws ClientException
- Specified by:
absoluteExpiryTime
in interfaceMessage<InputStream>
- Returns:
- the configured absolute time of expiration for this message.
- Throws:
ClientException
- if an error occurs while reading the given value.
-
absoluteExpiryTime
public StreamReceiverMessage absoluteExpiryTime(long expiryTime) throws ClientUnsupportedOperationException
Description copied from interface:Message
Sets the absolute expiration time value to assign to thisMessage
.An absolute time when this message is considered to be expired.
- Specified by:
absoluteExpiryTime
in interfaceMessage<InputStream>
- Parameters:
expiryTime
- The absolute expiration time value to assign to thisMessage
instance.- Returns:
- this
Message
instance. - Throws:
ClientUnsupportedOperationException
-
creationTime
public long creationTime() throws ClientException
- Specified by:
creationTime
in interfaceMessage<InputStream>
- Returns:
- the absolute time of creation for this message.
- Throws:
ClientException
- if an error occurs while reading the given value.
-
creationTime
public StreamReceiverMessage creationTime(long createTime) throws ClientUnsupportedOperationException
Description copied from interface:Message
Sets the creation time value to assign to thisMessage
.An absolute time when this message was created.
- Specified by:
creationTime
in interfaceMessage<InputStream>
- Parameters:
createTime
- The creation time value to assign to thisMessage
instance.- Returns:
- this
Message
instance. - Throws:
ClientUnsupportedOperationException
-
groupId
public String groupId() throws ClientException
- Specified by:
groupId
in interfaceMessage<InputStream>
- Returns:
- the assigned group ID for this message or null if not set.
- Throws:
ClientException
- if an error occurs while reading the given value.
-
groupId
public StreamReceiverMessage groupId(String groupId) throws ClientUnsupportedOperationException
Description copied from interface:Message
Sets the groupId value to assign to thisMessage
.Identifies the group the message belongs to.
- Specified by:
groupId
in interfaceMessage<InputStream>
- Parameters:
groupId
- The groupId value to assign to thisMessage
instance.- Returns:
- this
Message
instance. - Throws:
ClientUnsupportedOperationException
-
groupSequence
public int groupSequence() throws ClientException
- Specified by:
groupSequence
in interfaceMessage<InputStream>
- Returns:
- the assigned group sequence for this message.
- Throws:
ClientException
- if an error occurs while reading the given value.
-
groupSequence
public StreamReceiverMessage groupSequence(int groupSequence) throws ClientUnsupportedOperationException
Description copied from interface:Message
Sets the group sequence value to assign to thisMessage
.The relative position of this message within its group.
- Specified by:
groupSequence
in interfaceMessage<InputStream>
- Parameters:
groupSequence
- The group sequence to assign to thisMessage
instance.- Returns:
- this
Message
instance. - Throws:
ClientUnsupportedOperationException
-
replyToGroupId
public String replyToGroupId() throws ClientException
- Specified by:
replyToGroupId
in interfaceMessage<InputStream>
- Returns:
- the client-specific id used so that client can send replies to this message to a specific group.
- Throws:
ClientException
- if an error occurs while reading the given value.
-
replyToGroupId
public StreamReceiverMessage replyToGroupId(String replyToGroupId) throws ClientUnsupportedOperationException
Description copied from interface:Message
Sets the replyTo group Id value to assign to thisMessage
.This is a client-specific id that is used so that client can send replies to this message to a specific group.
- Specified by:
replyToGroupId
in interfaceMessage<InputStream>
- Parameters:
replyToGroupId
- The replyTo group Id to assign to thisMessage
instance.- Returns:
- this
Message
instance. - Throws:
ClientUnsupportedOperationException
-
properties
public Properties properties() throws ClientException
Description copied from interface:AdvancedMessage
Return the currentProperties
assigned to this message, if none was assigned yet then this method returnsnull
.- Specified by:
properties
in interfaceAdvancedMessage<InputStream>
- Returns:
- the currently assigned
Properties
for this message. - Throws:
ClientException
- if an error occurs while retrieving the message data.
-
properties
public StreamReceiverMessage properties(Properties properties) throws ClientUnsupportedOperationException
Description copied from interface:AdvancedMessage
Assign or replace theProperties
instance associated with this message.- Specified by:
properties
in interfaceAdvancedMessage<InputStream>
- Parameters:
properties
- TheProperties
value to assign to this message.- Returns:
- this
AdvancedMessage
instance. - Throws:
ClientUnsupportedOperationException
-
annotation
public Object annotation(String key) throws ClientException
Description copied from interface:Message
Returns the requested message annotation value from thisMessage
if it exists or returns null otherwise.- Specified by:
annotation
in interfaceMessage<InputStream>
- Parameters:
key
- The key of the message annotation to query for.- Returns:
- the corresponding message annotation value of null if none was carried in this
Message
. - Throws:
ClientException
- if an error occurs accessing the message annotations in thisMessage
.
-
hasAnnotation
public boolean hasAnnotation(String key) throws ClientException
Description copied from interface:Message
Query theMessage
to determine if it carries the given message annotation key.- Specified by:
hasAnnotation
in interfaceMessage<InputStream>
- Parameters:
key
- The key of the message annotation to query for.- Returns:
true
if the Message carries the given message annotation.- Throws:
ClientException
- if an error occurs accessing the message annotations in thisMessage
.
-
hasAnnotations
public boolean hasAnnotations() throws ClientException
Description copied from interface:Message
Query theMessage
to determine if it carries any message annotations.- Specified by:
hasAnnotations
in interfaceMessage<InputStream>
- Returns:
true
if the Message carries any message annotations.- Throws:
ClientException
- if an error occurs accessing the message annotations in thisMessage
.
-
removeAnnotation
public Object removeAnnotation(String key) throws ClientUnsupportedOperationException
Description copied from interface:Message
Removes the given message annotation from the values carried in the message currently, if none was present than this method returnsnull
.- Specified by:
removeAnnotation
in interfaceMessage<InputStream>
- Parameters:
key
- The key of the message annotation to query for removal.- Returns:
- the message annotation value that was previously assigned to that key.
- Throws:
ClientUnsupportedOperationException
-
forEachAnnotation
public StreamReceiverMessage forEachAnnotation(BiConsumer<String,Object> action) throws ClientException
Description copied from interface:Message
Invokes the givenBiConsumer
on each message annotation entry carried in thisMessage
.- Specified by:
forEachAnnotation
in interfaceMessage<InputStream>
- Parameters:
action
- The action that will be invoked on each message annotation entry.- Returns:
- this
Message
instance. - Throws:
ClientException
- if an error occurs accessing the message annotations in thisMessage
.
-
annotation
public StreamReceiverMessage annotation(String key, Object value) throws ClientUnsupportedOperationException
Description copied from interface:Message
Sets the given message annotation value at the given key, replacing any previous value that was assigned to thisMessage
.- Specified by:
annotation
in interfaceMessage<InputStream>
- Parameters:
key
- The message annotation key where the value is to be assigned.value
- The value to assign to the given message annotation key.- Returns:
- this
Message
instance. - Throws:
ClientUnsupportedOperationException
-
annotations
public MessageAnnotations annotations() throws ClientException
Description copied from interface:AdvancedMessage
Return the currentMessageAnnotations
assigned to this message, if none was assigned yet then this method returnsnull
.- Specified by:
annotations
in interfaceAdvancedMessage<InputStream>
- Returns:
- the currently assigned
MessageAnnotations
for this message. - Throws:
ClientException
- if an error occurs while retrieving the message data.
-
annotations
public StreamReceiverMessage annotations(MessageAnnotations messageAnnotations) throws ClientUnsupportedOperationException
Description copied from interface:AdvancedMessage
Assign or replace theMessageAnnotations
instance associated with this message.- Specified by:
annotations
in interfaceAdvancedMessage<InputStream>
- Parameters:
messageAnnotations
- TheMessageAnnotations
value to assign to this message.- Returns:
- this
AdvancedMessage
instance. - Throws:
ClientUnsupportedOperationException
-
property
public Object property(String key) throws ClientException
Description copied from interface:Message
Returns the requested application property value from thisMessage
if it exists or returns null otherwise.- Specified by:
property
in interfaceMessage<InputStream>
- Parameters:
key
- The key of the application property to query for.- Returns:
- the corresponding application property value of null if none was carried in this
Message
. - Throws:
ClientException
- if an error occurs accessing the application properties in thisMessage
.
-
hasProperty
public boolean hasProperty(String key) throws ClientException
Description copied from interface:Message
Query theMessage
to determine if it carries the given application property key.- Specified by:
hasProperty
in interfaceMessage<InputStream>
- Parameters:
key
- The key of the application property to query for.- Returns:
true
if the Message carries the given application property.- Throws:
ClientException
- if an error occurs accessing the application properties in thisMessage
.
-
hasProperties
public boolean hasProperties() throws ClientException
Description copied from interface:Message
Query theMessage
to determine if it carries any application properties.- Specified by:
hasProperties
in interfaceMessage<InputStream>
- Returns:
true
if the Message carries any application properties.- Throws:
ClientException
- if an error occurs accessing the application properties in thisMessage
.
-
removeProperty
public Object removeProperty(String key) throws ClientUnsupportedOperationException
Description copied from interface:Message
Removes the given application property from the values carried in the message currently, if none was present than this method returnsnull
.- Specified by:
removeProperty
in interfaceMessage<InputStream>
- Parameters:
key
- The key of the application property to query for removal.- Returns:
- the application property value that was previously assigned to that key.
- Throws:
ClientUnsupportedOperationException
-
forEachProperty
public StreamReceiverMessage forEachProperty(BiConsumer<String,Object> action) throws ClientException
Description copied from interface:Message
Invokes the givenBiConsumer
on each application property entry carried in thisMessage
.- Specified by:
forEachProperty
in interfaceMessage<InputStream>
- Parameters:
action
- The action that will be invoked on each application property entry.- Returns:
- this
Message
instance. - Throws:
ClientException
- if an error occurs accessing the application properties in thisMessage
.
-
property
public StreamReceiverMessage property(String key, Object value) throws ClientUnsupportedOperationException
Description copied from interface:Message
Sets the given application property value at the given key, replacing any previous value that was assigned to thisMessage
.- Specified by:
property
in interfaceMessage<InputStream>
- Parameters:
key
- The application property key where the value is to be assigned.value
- The value to assign to the given application property key.- Returns:
- this
Message
instance. - Throws:
ClientUnsupportedOperationException
-
applicationProperties
public ApplicationProperties applicationProperties() throws ClientException
Description copied from interface:AdvancedMessage
Return the currentApplicationProperties
assigned to this message, if none was assigned yet then this method returnsnull
.- Specified by:
applicationProperties
in interfaceAdvancedMessage<InputStream>
- Returns:
- the currently assigned
ApplicationProperties
for this message. - Throws:
ClientException
- if an error occurs while retrieving the message data.
-
applicationProperties
public StreamReceiverMessage applicationProperties(ApplicationProperties applicationProperties) throws ClientUnsupportedOperationException
Description copied from interface:AdvancedMessage
Assign or replace theApplicationProperties
instance associated with this message.- Specified by:
applicationProperties
in interfaceAdvancedMessage<InputStream>
- Parameters:
applicationProperties
- TheApplicationProperties
value to assign to this message.- Returns:
- this
AdvancedMessage
instance. - Throws:
ClientUnsupportedOperationException
-
footer
public Object footer(String key) throws ClientException
Description copied from interface:Message
Returns the requested footer value from thisMessage
if it exists or returnsnull
otherwise.- Specified by:
footer
in interfaceMessage<InputStream>
- Parameters:
key
- The key of the footer to query for.- Returns:
- the corresponding footer value of null if none was carried in this
Message
. - Throws:
ClientException
- if an error occurs accessing the footers in thisMessage
.
-
hasFooter
public boolean hasFooter(String key) throws ClientException
Description copied from interface:Message
Query theMessage
to determine if it carries the given footer key.- Specified by:
hasFooter
in interfaceMessage<InputStream>
- Parameters:
key
- The key of the footer to query for.- Returns:
true
if the Message carries the given footer.- Throws:
ClientException
- if an error occurs accessing the footers in thisMessage
.
-
hasFooters
public boolean hasFooters() throws ClientException
Description copied from interface:Message
Query theMessage
to determine if it carries any footers.- Specified by:
hasFooters
in interfaceMessage<InputStream>
- Returns:
true
if the Message carries any footers.- Throws:
ClientException
- if an error occurs accessing the footers in thisMessage
.
-
removeFooter
public Object removeFooter(String key) throws ClientUnsupportedOperationException
Description copied from interface:Message
Removes the given footer from the values carried in the message currently, if none was present than this method returnsnull
.- Specified by:
removeFooter
in interfaceMessage<InputStream>
- Parameters:
key
- The key of the footer to query for removal.- Returns:
- the footer value that was previously assigned to that key.
- Throws:
ClientUnsupportedOperationException
-
forEachFooter
public StreamReceiverMessage forEachFooter(BiConsumer<String,Object> action) throws ClientException
Description copied from interface:Message
Invokes the givenBiConsumer
on each footer entry carried in thisMessage
.- Specified by:
forEachFooter
in interfaceMessage<InputStream>
- Parameters:
action
- The action that will be invoked on each footer entry.- Returns:
- this
Message
instance. - Throws:
ClientException
- if an error occurs accessing the footers in thisMessage
.
-
footer
public StreamReceiverMessage footer(String key, Object value) throws ClientUnsupportedOperationException
Description copied from interface:Message
Sets the given footer value at the given key, replacing any previous value that was assigned to thisMessage
.- Specified by:
footer
in interfaceMessage<InputStream>
- Parameters:
key
- The footer key where the value is to be assigned.value
- The value to assign to the given footer key.- Returns:
- this
Message
instance. - Throws:
ClientUnsupportedOperationException
-
footer
public Footer footer() throws ClientException
Description copied from interface:AdvancedMessage
Return the currentFooter
assigned to this message, if none was assigned yet then this method returnsnull
.- Specified by:
footer
in interfaceAdvancedMessage<InputStream>
- Returns:
- the currently assigned
Footer
for this message. - Throws:
ClientException
- if an error occurs while retrieving the message data.
-
footer
public StreamReceiverMessage footer(Footer footer) throws ClientUnsupportedOperationException
Description copied from interface:AdvancedMessage
Assign or replace theFooter
instance associated with this message.- Specified by:
footer
in interfaceAdvancedMessage<InputStream>
- Parameters:
footer
- TheFooter
value to assign to this message.- Returns:
- this
AdvancedMessage
instance. - Throws:
ClientUnsupportedOperationException
-
addBodySection
public StreamReceiverMessage addBodySection(Section<?> bodySection) throws ClientUnsupportedOperationException
Description copied from interface:AdvancedMessage
Adds the givenSection
to the internal collection of sections that will be sent to the remote peer when this message is encoded. If a previous section was added by a call to theMessage.body(Object)
method it should be retained as the first element of the running list of body sections contained in this message.The implementation should make an attempt to validate that sections added are valid for the message format that is assigned when they are added.
- Specified by:
addBodySection
in interfaceAdvancedMessage<InputStream>
- Parameters:
bodySection
- TheSection
instance to append to the internal collection.- Returns:
- this
AdvancedMessage
instance. - Throws:
ClientUnsupportedOperationException
-
bodySections
public StreamReceiverMessage bodySections(Collection<Section<?>> sections) throws ClientUnsupportedOperationException
Description copied from interface:AdvancedMessage
Sets the bodySection
instances to use when encoding this message. The value given replaces any existing sections assigned to this message through theMessage.body(Object)
orAdvancedMessage.addBodySection(Section)
methods. Calling this method with a null or empty collection is equivalent to calling theAdvancedMessage.clearBodySections()
method.- Specified by:
bodySections
in interfaceAdvancedMessage<InputStream>
- Parameters:
sections
- TheCollection
ofSection
instance to assign this message.- Returns:
- this
AdvancedMessage
instance. - Throws:
ClientUnsupportedOperationException
-
bodySections
public Collection<Section<?>> bodySections() throws ClientUnsupportedOperationException
Description copied from interface:AdvancedMessage
Create and return an unmodifiableCollection
that contains theSection
instances currently assigned to this message. Changes to this message body after calling this will not be reflected in the returned collection.- Specified by:
bodySections
in interfaceAdvancedMessage<InputStream>
- Returns:
- an unmodifiable
Collection
that is a view of the current sections assigned to this message. - Throws:
ClientUnsupportedOperationException
-
forEachBodySection
public StreamReceiverMessage forEachBodySection(Consumer<Section<?>> consumer) throws ClientUnsupportedOperationException
Description copied from interface:AdvancedMessage
Performs the given action for each bodySection
of theAdvancedMessage
until all sections have been presented to the givenConsumer
or the consumer throws an exception.- Specified by:
forEachBodySection
in interfaceAdvancedMessage<InputStream>
- Parameters:
consumer
- theConsumer
that will operate on each of the body sections in this message.- Returns:
- this
AdvancedMessage
instance. - Throws:
ClientUnsupportedOperationException
-
clearBodySections
public StreamReceiverMessage clearBodySections() throws ClientUnsupportedOperationException
Description copied from interface:AdvancedMessage
Clears all current bodySection
elements from theAdvancedMessage
.- Specified by:
clearBodySections
in interfaceAdvancedMessage<InputStream>
- Returns:
- this
AdvancedMessage
instance. - Throws:
ClientUnsupportedOperationException
-
body
public InputStream body() throws ClientException
Description copied from interface:Message
Returns the body value that is conveyed in this message or null if no body was set locally or sent from the remote if this is an incoming message.- Specified by:
body
in interfaceMessage<InputStream>
- Returns:
- the message body value or null if none present.
- Throws:
ClientException
- if the implementation can't provide a body for some reason.
-
body
public StreamReceiverMessage body(InputStream value) throws ClientUnsupportedOperationException
Description copied from interface:Message
Sets the body value that is to be conveyed to the remote when this message is sent.The
Message
implementation will choose the AMQPSection
to use to wrap the given value.- Specified by:
body
in interfaceMessage<InputStream>
- Parameters:
value
- The value to assign to the given message bodySection
.- Returns:
- this
Message
instance. - Throws:
ClientUnsupportedOperationException
-
encode
public ProtonBuffer encode(Map<String,Object> deliveryAnnotations) throws ClientUnsupportedOperationException
Description copied from interface:AdvancedMessage
Encodes theAdvancedMessage
for transmission by the client. The providedDeliveryAnnotations
can be included or augmented by theAdvancedMessage
implementation based on the target message format. The implementation is responsible for ensuring that the delivery annotations are treated correctly encoded into the correct location in the message.- Specified by:
encode
in interfaceAdvancedMessage<InputStream>
- Parameters:
deliveryAnnotations
- AMap
of delivery annotation values that were requested to be included in the transmitted message.- Returns:
- the encoded form of this message in a
ProtonBuffer
instance. - Throws:
ClientUnsupportedOperationException
-
-