Closed petervdz closed 1 year ago
@petervdz
https://stackoverflow.com/questions/23299147/how-to-set-jmsmessageid-and-jmscorrelationid-properly
So normally this ID is set by Camel/Assimbly. There are a few options to work with MessageID (https://camel.apache.org/components/3.14.x/jms-component.html). The IBMMQ component is based on the Camel JMS Component.
Generally, you can set the result type of a header like this:
<setHeader headerName="myKey">
<simple resultType="java.lang.String">myValue</simple>
</setHeader>
As a byte array:
<setHeader headerName="myKey">
<simple resultType="byte[]">myValue</simple>
</setHeader>
or from a header
<setHeader headerName="myKey">
<simple resultType="byte[]">${header.someKey}</simple>
</setHeader>
3) Also note that it sometimes tricky to connect to IBMMQ (it's more extensive than most MQ's). I once need to set a HEX literally (because it needed a HEX in EBCDIC)
p.s. I could discuss this with @tomosjut when needed (because I now don't have a IBMMQ instance to test).
Hi Raymond, I know it's uncommon to want to set the JMSMessageID, but in this case it's neccesary (temporary) because our integration platform is put in between an existing chain to be able to fase out some old legacy. I will try the code-suggestions! And @tomosjut is now on a holiday but will be back soon! Regards, Peter.
I've tried the setHeader as suggested, it now doesn't give me the error above any more (so thanks!), but still IBM MQ generates its own msgid - so setting the JMS_IBM_MQMD_MsgId - which I found in some posts shoud do the trick - doesn't work here.
It is indeed uncommon to set the JMSMessageID yourself. It even goes against JMS specifications. But it is possible to set your own JMSMessageID. There are a few things to take in account:
byte b = (byte) Integer.parseInt("c4", 16);
<setHeader name="CamelJmsDestinationName"><constant>queue:///destination?mdWriteEnabled=true</constant></setHeader>
Closing as Thomas port this to Fuse.
We need to set the JMSMessageID for IBM MQ in the messages for a specific flow. To do this, we fill the JMS_IBM_MQMD_MsgId (see xml below) in a route - but when sending the message to IBM MQ it returns an error: JMSCC0051: The property 'JMS_IBM_MQMD_MsgId' should be set using type '[B', not 'java.lang.String'. How to do it properly?
Example code: