Package org.apache.qpid.protonj2.client
Interface AdvancedMessage<E>
- 
- Type Parameters:
- E- The type of the message body that this message carries
 - All Superinterfaces:
- Message<E>
 - All Known Subinterfaces:
- StreamReceiverMessage,- StreamSenderMessage
 - All Known Implementing Classes:
- ClientMessage,- ClientStreamReceiverMessage
 
 public interface AdvancedMessage<E> extends Message<E> Advanced AMQP Message object that provides a thin abstraction to raw AMQP types
- 
- 
Method SummaryAll Methods Static Methods Instance Methods Abstract Methods Modifier and Type Method Description AdvancedMessage<E>addBodySection(Section<?> bodySection)Adds the givenSectionto the internal collection of sections that will be sent to the remote peer when this message is encoded.MessageAnnotationsannotations()Return the currentMessageAnnotationsassigned to this message, if none was assigned yet then this method returnsnull.AdvancedMessage<E>annotations(MessageAnnotations messageAnnotations)Assign or replace theMessageAnnotationsinstance associated with this message.ApplicationPropertiesapplicationProperties()Return the currentApplicationPropertiesassigned to this message, if none was assigned yet then this method returnsnull.AdvancedMessage<E>applicationProperties(ApplicationProperties applicationProperties)Assign or replace theApplicationPropertiesinstance associated with this message.Collection<Section<?>>bodySections()Create and return an unmodifiableCollectionthat contains theSectioninstances currently assigned to this message.AdvancedMessage<E>bodySections(Collection<Section<?>> sections)Sets the bodySectioninstances to use when encoding this message.AdvancedMessage<E>clearBodySections()Clears all current bodySectionelements from theAdvancedMessage.static <V> AdvancedMessage<V>create()Creates a newAdvancedMessageinstance using the library default implementation.ProtonBufferencode(Map<String,Object> deliveryAnnotations)Encodes theAdvancedMessagefor transmission by the client.Footerfooter()Return the currentFooterassigned to this message, if none was assigned yet then this method returnsnull.AdvancedMessage<E>footer(Footer footer)Assign or replace theFooterinstance associated with this message.AdvancedMessage<E>forEachBodySection(Consumer<Section<?>> consumer)Performs the given action for each bodySectionof theAdvancedMessageuntil all sections have been presented to the givenConsumeror the consumer throws an exception.Headerheader()Return the currentHeaderassigned to this message, if none was assigned yet then this method returnsnull.AdvancedMessage<E>header(Header header)Assign or replace theHeaderinstance associated with this message.intmessageFormat()AdvancedMessage<E>messageFormat(int messageFormat)Sets the message format to use when the message is sent.Propertiesproperties()Return the currentPropertiesassigned to this message, if none was assigned yet then this method returnsnull.AdvancedMessage<E>properties(Properties properties)Assign or replace thePropertiesinstance associated with this message.- 
Methods inherited from interface org.apache.qpid.protonj2.client.MessageabsoluteExpiryTime, absoluteExpiryTime, annotation, annotation, body, body, contentEncoding, contentEncoding, contentType, contentType, correlationId, correlationId, creationTime, creationTime, deliveryCount, deliveryCount, durable, durable, firstAcquirer, firstAcquirer, footer, footer, forEachAnnotation, forEachFooter, forEachProperty, groupId, groupId, groupSequence, groupSequence, hasAnnotation, hasAnnotations, hasFooter, hasFooters, hasProperties, hasProperty, messageId, messageId, priority, priority, property, property, removeAnnotation, removeFooter, removeProperty, replyTo, replyTo, replyToGroupId, replyToGroupId, subject, subject, timeToLive, timeToLive, to, to, toAdvancedMessage, userId, userId
 
- 
 
- 
- 
- 
Method Detail- 
createstatic <V> AdvancedMessage<V> create() Creates a newAdvancedMessageinstance using the library default implementation.- Type Parameters:
- V- The type to use when specifying the body section value type.
- Returns:
- a new AdvancedMessageinstance.
 
 - 
headerHeader header() throws ClientException Return the currentHeaderassigned to this message, if none was assigned yet then this method returnsnull.- Returns:
- the currently assigned Headerfor this message.
- Throws:
- ClientException- if an error occurs while retrieving the message data.
 
 - 
headerAdvancedMessage<E> header(Header header) throws ClientException Assign or replace theHeaderinstance associated with this message.- Parameters:
- header- The- Headervalue to assign to this message.
- Returns:
- this AdvancedMessageinstance.
- Throws:
- ClientException- if an error occurs while writing the message- Headervalue.
 
 - 
annotationsMessageAnnotations annotations() throws ClientException Return the currentMessageAnnotationsassigned to this message, if none was assigned yet then this method returnsnull.- Returns:
- the currently assigned MessageAnnotationsfor this message.
- Throws:
- ClientException- if an error occurs while retrieving the message data.
 
 - 
annotationsAdvancedMessage<E> annotations(MessageAnnotations messageAnnotations) throws ClientException Assign or replace theMessageAnnotationsinstance associated with this message.- Parameters:
- messageAnnotations- The- MessageAnnotationsvalue to assign to this message.
- Returns:
- this AdvancedMessageinstance.
- Throws:
- ClientException- if an error occurs while writing the message- MessageAnnotationsvalue.
 
 - 
propertiesProperties properties() throws ClientException Return the currentPropertiesassigned to this message, if none was assigned yet then this method returnsnull.- Returns:
- the currently assigned Propertiesfor this message.
- Throws:
- ClientException- if an error occurs while retrieving the message data.
 
 - 
propertiesAdvancedMessage<E> properties(Properties properties) throws ClientException Assign or replace thePropertiesinstance associated with this message.- Parameters:
- properties- The- Propertiesvalue to assign to this message.
- Returns:
- this AdvancedMessageinstance.
- Throws:
- ClientException- if an error occurs while writing the message- Propertiesvalue.
 
 - 
applicationPropertiesApplicationProperties applicationProperties() throws ClientException Return the currentApplicationPropertiesassigned to this message, if none was assigned yet then this method returnsnull.- Returns:
- the currently assigned ApplicationPropertiesfor this message.
- Throws:
- ClientException- if an error occurs while retrieving the message data.
 
 - 
applicationPropertiesAdvancedMessage<E> applicationProperties(ApplicationProperties applicationProperties) throws ClientException Assign or replace theApplicationPropertiesinstance associated with this message.- Parameters:
- applicationProperties- The- ApplicationPropertiesvalue to assign to this message.
- Returns:
- this AdvancedMessageinstance.
- Throws:
- ClientException- if an error occurs while writing the message- ApplicationPropertiesvalue.
 
 - 
footerFooter footer() throws ClientException Return the currentFooterassigned to this message, if none was assigned yet then this method returnsnull.- Returns:
- the currently assigned Footerfor this message.
- Throws:
- ClientException- if an error occurs while retrieving the message data.
 
 - 
footerAdvancedMessage<E> footer(Footer footer) throws ClientException Assign or replace theFooterinstance associated with this message.- Parameters:
- footer- The- Footervalue to assign to this message.
- Returns:
- this AdvancedMessageinstance.
- Throws:
- ClientException- if an error occurs while writing the message- Footervalue.
 
 - 
messageFormatint messageFormat() throws ClientException- Returns:
- the currently assigned message format for this message.
- Throws:
- ClientException- if an error occurs while retrieving the message data.
 
 - 
messageFormatAdvancedMessage<E> messageFormat(int messageFormat) throws ClientException 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- Parameters:
- messageFormat- The message format to encode into the transfer frame that carries the message.
- Returns:
- this AdvancedMessageinstance.
- Throws:
- ClientException- if an error occurs while configuring the message format.
 
 - 
addBodySectionAdvancedMessage<E> addBodySection(Section<?> bodySection) throws ClientException Adds the givenSectionto 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. - Parameters:
- bodySection- The- Sectioninstance to append to the internal collection.
- Returns:
- this AdvancedMessageinstance.
- Throws:
- ClientException- if an error occurs while writing to the message body sections.
 
 - 
bodySectionsAdvancedMessage<E> bodySections(Collection<Section<?>> sections) throws ClientException Sets the bodySectioninstances to use when encoding this message. The value given replaces any existing sections assigned to this message through theMessage.body(Object)oraddBodySection(Section)methods. Calling this method with a null or empty collection is equivalent to calling theclearBodySections()method.- Parameters:
- sections- The- Collectionof- Sectioninstance to assign this message.
- Returns:
- this AdvancedMessageinstance.
- Throws:
- ClientException- if an error occurs while writing to the message body sections.
 
 - 
bodySectionsCollection<Section<?>> bodySections() throws ClientException Create and return an unmodifiableCollectionthat contains theSectioninstances currently assigned to this message. Changes to this message body after calling this will not be reflected in the returned collection.- Returns:
- an unmodifiable Collectionthat is a view of the current sections assigned to this message.
- Throws:
- ClientException- if an error occurs while retrieving the message data.
 
 - 
forEachBodySectionAdvancedMessage<E> forEachBodySection(Consumer<Section<?>> consumer) throws ClientException Performs the given action for each bodySectionof theAdvancedMessageuntil all sections have been presented to the givenConsumeror the consumer throws an exception.- Parameters:
- consumer- the- Consumerthat will operate on each of the body sections in this message.
- Returns:
- this AdvancedMessageinstance.
- Throws:
- ClientException- if an error occurs while iterating over the message data.
 
 - 
clearBodySectionsAdvancedMessage<E> clearBodySections() throws ClientException Clears all current bodySectionelements from theAdvancedMessage.- Returns:
- this AdvancedMessageinstance.
- Throws:
- ClientException- if an error occurs while clearing the message body sections.
 
 - 
encodeProtonBuffer encode(Map<String,Object> deliveryAnnotations) throws ClientException Encodes theAdvancedMessagefor transmission by the client. The providedDeliveryAnnotationscan be included or augmented by theAdvancedMessageimplementation 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.- Parameters:
- deliveryAnnotations- A- Mapof delivery annotation values that were requested to be included in the transmitted message.
- Returns:
- the encoded form of this message in a ProtonBufferinstance.
- Throws:
- ClientException- if an error occurs while encoding the message data.
 
 
- 
 
-