Clearly both setObject(name, map) and setObject(name, mapMsg) work. As you correctly point out, using a hierarchical naming scheme would allow the client to specify nesting and works with any MOM.
However, I would argue that forcing clients to write code to create/parse a hierarchical naming scheme defeats the key goal of ease of use. For instance, suppose one wants to create a framework for marshaling arbitrary beans to JMS messages. A logical implmentation would be to use reflection to discover bean properties and create a corresponding MapMessage. Now, suppose that a bean contains other beans as properties. One elegant approach would to marshal each bean property to a nested MapMessage. This exact strategy is used by many systems on Wall Street and by open-source projects (messageforge.sourceforge.net). BTW - the underlying JMS provider can, beneath the covers, use hierarchical naming schemes and strip off properties from nested messages. As far as the client is concerned, this should just be an implementation detail and not the required way for clients to use the MOM. -- View this message in context: http://www.nabble.com/Nested-MapMessage-t1788442.html#a4902932 Sent from the ActiveMQ - Dev forum at Nabble.com.
