How would you implement a Content Enricher in WebSphere MQ using Java?
Given an existing input message is provided from a queue, here are some of my ideas, none of which satisfies me:
- Deep-clone the message object. Here is an explanation of how it could be done, but I can't find either
clone()
orserialize()
methods for the javax.jms.Message class. - Take the original message, set the additional properties using
setXXXProperty()
and send it forward. This throws an exception suggesting that the message is read-only. - Create a new message, iterate over properties of the
existing message and set them to the new message.
getPropertyNames()
can help to do this, but it says nothing about types of properties, so this information will be lost.