On 01/26/2013 03:43 PM, Fraser Adams wrote:
I've said the following a couple of times on the Qpid Users mailing
list, but nobody has yet bitten, hopefully this issue might start the
discussion again....

IMHO the *only* correct way to expose amqp/map or amqp/list in JMS in a
way that doesn't break the JMS specification is to use
javax.jms.ObjectMessage.

My concern, at least on the sending side, is that people expect java serialization to be used with such messages and therefore expect to be able to use arbitrary java objects with it (as well as relying on e.g. custom readObject()/writeObject()/readExternal()/writeExternal() methods).

While I think that an AMQP encoding for general objects is an interesting avenue to consider[1], its a larger problem than simply handling (potentially recursive) maps and lists of primitive types.

The use of MapMessage and StreamMessage is not driven from a love of those interfaces, but from the fact that they are already defined and there may be applications using them or developers used to working with them.

It is true we don't enforce that lists/maps are non-recursive and that is strictly violating the standard. That fact is noted in the documentation. It would probably be nice to have a way to enable strict compliance as well. It is certainly an issue for QMF messages, which do contain nested lists and maps, but it might not be for other uses.

Likewise however encoding ObjectMessages as an amqp/map rather than using serialization to generate the sequence of bytes might be considered a violation of the specification also.

What we have is certainly not perfect. The JMS API itself is not perfect here.

The idea was to allow AMQP encoded data to be accessed via a variety of interfaces so you can pick the one you prefer. Extending the current options such that a map or list encoded message could also be accessed as an ObjectMessage seems like a reasonable enhancement to me.

The sending side has the added issue of needing to infer the desired encoding in some way. If you allow different encodings for a particular Message type then you need some other explicit way to choose between them.

--Gordon.

[1] AMQP 1.0 provides annotations that could be used to indicate class in a standard way.

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to