Re: Amqp Spec : multiple byte[] is not supported for DATA
The comment you linked to outlined three separate potential ways to send multiple data sections. You implemented a kind of hybrid of the 1st and 2nd of the routes given, with the 2nd probably being the clunkiest approach by far. I'd suggest you go for purely the 1st route (encoding a Message object with only a Data body set will get you the bytes for only the Data section, as your code below is already relying on..so you can simply repeat that process for each section), or use the 3rd route (manually encode the data sections, by trivially writing the 5 or 8 bytes needed to set the appropriate descriptor and length of the section, e.g as demonstrated by how the actual encoding does it at [1]+[2]), or avoid all of those and head straight to using the encoder+decoder as Tim's comment about looking at the message impl and doing your own would result. You will have to do the latter if you want to receive multiple such data sections, the Message object simply cant help you there. If you use the newer ReadableBuffer and WritableBuffer decoding/encoding variants you wont need to do most of the array tracking your code is doing, the buffers would handle it themselves (youd simply pull the underlying array/buffer at the end if you want it). You'll see the message impl and encoder always do that internally. Please use the users list for future threads. [1] https://github.com/apache/qpid-proton-j/blob/0.33.7/proton-j/src/main/java/org/apache/qpid/proton/codec/messaging/FastPathDataType.java#L121-L127 [2] https://github.com/apache/qpid-proton-j/blob/0.33.7/proton-j/src/main/java/org/apache/qpid/proton/codec/BinaryType.java#L70-L88 On Sun, 1 Nov 2020 at 04:23, hemanttanwar wrote: > > Thank you for your timely response. > > I will look into the MessageImpl.java implementation you referenced. > > Another way to achieve this was explained in following thread and I tried to > implement it But this is treated as "three separate amqp messages with one > data section" rather than "one amqp message with three data sections". > > I want to make sure I am implementing it correctly as explained here > > https://issues.apache.org/jira/browse/PROTON-1098?focusedCommentId=15098238&page=com.atlassian.jira.plugin.system.issuetabpanels%3Acomment-tabpanel#comment-15098238 > > Here is my implementation. > > https://github.com/hemanttanwar/proton-j-multiple-data/blob/main/data-multi-section/src/main/java/com/protonj/app/MultipleDataSender.java#L43 > > Appreciate your input on this. > > > > > -- > Sent from: > http://qpid.2158936.n2.nabble.com/Apache-Qpid-developers-f7254403.html > > - > To unsubscribe, e-mail: dev-unsubscr...@qpid.apache.org > For additional commands, e-mail: dev-h...@qpid.apache.org > - To unsubscribe, e-mail: dev-unsubscr...@qpid.apache.org For additional commands, e-mail: dev-h...@qpid.apache.org
Re: Amqp Spec : multiple byte[] is not supported for DATA
Thank you for your timely response. I will look into the MessageImpl.java implementation you referenced. Another way to achieve this was explained in following thread and I tried to implement it But this is treated as "three separate amqp messages with one data section" rather than "one amqp message with three data sections". I want to make sure I am implementing it correctly as explained here https://issues.apache.org/jira/browse/PROTON-1098?focusedCommentId=15098238&page=com.atlassian.jira.plugin.system.issuetabpanels%3Acomment-tabpanel#comment-15098238 Here is my implementation. https://github.com/hemanttanwar/proton-j-multiple-data/blob/main/data-multi-section/src/main/java/com/protonj/app/MultipleDataSender.java#L43 Appreciate your input on this. -- Sent from: http://qpid.2158936.n2.nabble.com/Apache-Qpid-developers-f7254403.html - To unsubscribe, e-mail: dev-unsubscr...@qpid.apache.org For additional commands, e-mail: dev-h...@qpid.apache.org
Re: Amqp Spec : multiple byte[] is not supported for DATA
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: dev-unsubscr...@qpid.apache.org For additional commands, e-mail: dev-h...@qpid.apache.org -- Tim Bish - To unsubscribe, e-mail: dev-unsubscr...@qpid.apache.org For additional commands, e-mail: dev-h...@qpid.apache.org
Amqp Spec : multiple byte[] is not supported for DATA
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 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: dev-unsubscr...@qpid.apache.org For additional commands, e-mail: dev-h...@qpid.apache.org