-1

I'm currently working on a project using Mirth Connect 3.0.1 and a biological instrument. I'm sending a JMS message with Mirth Connect to this instrument, by using ActiveMQ broker. The JMS receiver on my instrument is a specific java connector, who's expecting a well-formatted JMS header with some specific and required fields.

I would like to know if it is possible to modify the JMS header sent by Mirth Connect ? I didn't find any information on it.

For example, I would like to add a field on my JMS Header and put a value.

If it's not possible, do you know if I can do that with ActiveMQ ? Maybe, I have to write my own ActiveMQ library ?

Thank you for your help.

elixenide
  • 44,308
  • 16
  • 74
  • 100

1 Answers1

1

As per JMS specs

Property values are set prior to sending a message. When a client receives a
message, its properties are in read-only mode. If a client attempts to set
properties at this point, a MessageNotWriteableException is thrown.

so if you want to set any properties then you must call clearProperties() on the message and then set your own values.

Aniket Thakur
  • 66,731
  • 38
  • 279
  • 289
  • Could you please give more details on the usage of 'clearProperties()' method ? –  Jan 30 '14 at 15:42
  • After you receive message you have to call `clearProperties()` on that message before you can set some properties on it.[docs](http://docs.oracle.com/cd/E17802_01/products/products/jms/javadoc-102a/javax/jms/Message.html#clearProperties%28%29) – Aniket Thakur Jan 30 '14 at 16:22
  • I need to clear properties before sending the message, not when it's received by the instrument –  Jan 31 '14 at 09:21
  • Well in that case you have no problem. You can directly set your properties using `setStringProperty()`. For all available APIs see the docs link I gave in previous comment. It is not specific to ActiveMQ... it is in JMS specs. So you can do it with any JMS provider. – Aniket Thakur Jan 31 '14 at 09:28