On 19 February 2015 at 04:22, Rafael Schloming <r...@alum.mit.edu> wrote:
> On Wed, Feb 18, 2015 at 3:58 PM, Rajith Muditha Attapattu <
> rajit...@gmail.com> wrote:
>
>> Setting the message body for an o.a.q.proton.message.Message is slightly
>> awkward.
>> You have to create a AmqpValue. AmqpSequence or a Data object that
>> encapsulates the underlying data type.
>>
>> Given that one of our goals is to expose an API that works with standard
>> Java types instead of AMQP defined types, I suggest we simply use Object
>> for setBody and getBody methods.
>> The implementation can then handle the conversion back and forth
>> underneath.
>>
>> What do you think?
>>
>
> Makes sense to me.
>
> --Rafael

Adding additional functionality to set/get a 'body object' like this
certainly might be useful in cases, but I dont think it should be the
only way. I also wouldnt change the existing methods to do this unless
the idea is to let you continue setting/getting the existing Section
objects unchanged (it would obviously likely break all existing user
code sending payloads otherwise). I can see that being easy enough for
the setter as it works now, though I dont see how it could work for
the getter without adding a control toggle.

Doing this would simply some use cases, but also further restrict the
ability to send the bodies you want or know what you really received,
e.g is a List an AmqpvValue+List or an AmqpSequence? Is <some-object>
an AmqpValue+Binary, or is it a Data? There is then things like how to
support e.g multiple Data and AmqpSequence sections (something it
should already support but doesnt).

Robbie

Reply via email to