On 10/30/20 4:44 PM, hemanttanwar wrote:
The AMQP Spec says a AMQP Message can have “one or more data sections” (see
link below)
Proton-j Message
(https://qpid.apache.org/releases/qpid-proton-j-0.33.4/api/org/apache/qpid/proton/message/Message.html)
setBody(Section body) (does not allow multiple Section to be set in body)
Data implement Section
(https://qpid.apache.org/releases/qpid-proton-j-0.33.4/api/org/apache/qpid/proton/amqp/messaging/Data.html)
https://qpid.apache.org/releases/qpid-proton-j-0.33.4/api/org/apache/qpid/proton/amqp/messaging/Section.html
The Message class in proton-j is a utility meant to aid with simple use
cases but does not expose the entire breadth of what can be encoded into
an AMQP message. If you want to encode a message with multiple data
sections for some reason then you will need to take this on in a similar
manner to how the Message implementation performs a message encode. The
mechanics of encoding are not that difficult to implement and I know of
a few implementations that have forgone the use of the Message class in
favor of something more tailored to their own needs.
You can see the details of encoding in the MessageImpl class here:
https://github.com/apache/qpid-proton-j/blob/a72aff32085e4780579d909afb4dcec7d4122d50/proton-j/src/main/java/org/apache/qpid/proton/message/impl/MessageImpl.java#L712
I would caution that you should ensure the bits receiving your messages
can properly deal with messages containing multiple data sections, I can
think of a few places where this might cause trouble.
So here is how we are doing.
Message amqpMessage = Proton.message();
byte[] body = “my data”.getBytes();
amqpMessage.setBody(new Data(new Binary(body)));
How can I support "one or 'more' data sections" using this library, It only
support 'One Data section' ?
Spec :
http://docs.oasis-open.org/amqp/core/v1.0/os/amqp-core-messaging-v1.0-os.html#type-
http://docs.oasis-open.org/amqp/core/v1.0/os/amqp-core-messaging-v1.0-os.html#type-data
Hemant
--
Sent from:
http://qpid.2158936.n2.nabble.com/Apache-Qpid-developers-f7254403.html
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]
--
Tim Bish
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]