Github user gemmellr commented on the pull request:

    https://github.com/apache/qpid-proton/pull/54#issuecomment-171666793
  
    Hi Sreeram
    
    Expanding the Message[Impl] to support multiple body sections is something 
that would be good to see done, but isn't something I've had time for 
previously and I'm working on other things at the moment. Whilst this change 
certainly works, I'm not sure the approach would fit in particularly well with 
making those more general improvements. 
    
    It is worth noting that the Message[Impl] in proton-j is basically just a 
helper in the end that you don't actually have to use, the actual message bytes 
sent via the Delivery object can be generated in other ways.
    
    In the mean time, with what is available now there are some ways I think 
you could probably send multiple Data sections currently, for example:
    - Use an Message object with any 
headers/delivery-annotations/message-annotations/properties/application-properties
 (and perhaps even the first data section set as the body), encode that.
    - Encode subsequent data body sections and append to the previous bytes.
    
    For the second bit above there would be various options, such as:
    - Use a Message object with only a data body set, encode that and append to 
previous bytes, repeating as needed for the n'th data section.
    - Use the very confusingly named org.apache.qpid.proton.codec.Data (which 
has nothing specifically to do with data sections) to write out all the data 
sections as DescribedType's. We do something similar in a test peer for the JMS 
client codebase, e.g at [1] it prepares an entire message this way with the 
body content possibly being a DataDescribedType [2].
    - Write a simple encoder to generate the data section bytes by writing out 
the necessary descriptor + Binary format/length bytes followed by the content 
bytes.
    
    [1] 
https://github.com/apache/qpid-jms/blob/2f3c1988606c215cca0bbb77d3462cdc15c36016/qpid-jms-client/src/test/java/org/apache/qpid/jms/test/testpeer/TestAmqpPeer.java#L1443
    [2] 
https://github.com/apache/qpid-jms/blob/2f3c1988606c215cca0bbb77d3462cdc15c36016/qpid-jms-client/src/test/java/org/apache/qpid/jms/test/testpeer/describedtypes/sections/DataDescribedType.java
    Note that [2] is using the symbolic descriptor, but for non-test code the 
numeric descriptor would probably be preferred.
    



---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---

Reply via email to