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 <[email protected]> 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: [email protected] > For additional commands, e-mail: [email protected] > --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
