Trying to figure out the camel/Spring configuration to set ApplicationIdData using JMS.
I know the java way to do it as below, I set MQOO_SET_IDENTITY_CONTEXT using bel
All I needed to find a way in camel config to set some properties in the destination and set some header. I set destination in the header as
<setHeader headerName="CamelJmsDestinationName"> queue:///Q_Name?targetClient=1&mdWriteEnabled=true&mdMessageContext=1</setHeader>
Note: Setting mdWriteEnabled=true is equal to
// Enable MQMD write
dest.setBooleanProperty(WMQConstants.WMQ_MQMD_WRITE_ENABLED, true);
Setting mdMessageContext=1 is equal to
// Optionally, set a message context if applicable for this MD field
dest.setIntProperty(WMQConstants.WMQ_MQMD_MESSAGE_CONTEXT,
WMQConstants.WMQ_MDCTX_SET_IDENTITY_CONTEXT);
Then set ApplicationIdData as <setHeader headerName="JMS_IBM_MQMD_ApplIdentityData" > BSI_XML_CANADA_ACK BSI_XML_CANADA_ACK </setHeader>
Complete code:
<route id="ValidateAndAck" streamCache="true">
<from uri="sql:{{ValidateCDMsg}}" />
<setHeader headerName="CamelJmsDestinationName"> <constant>queue:///Q_Name?targetClient=1&mdWriteEnabled=true&mdMessageContext=1</constant></setHeader>
<setHeader headerName="mdWriteEnabled"> <simple>true</simple></setHeader> <!-- This may be redundant-->
<setHeader headerName="mdMessageContext"> <simple>2</simple></setHeader> <!-- This may be redundant-->
<setHeader headerName="JMS_IBM_MQMD_ApplIdentityData" >
<simple>APP_ID_NAME</simple>
</setHeader>
<setHeader headerName="JMS_IBM_MQMD_ApplOriginData" >
<simple>APP_ID_NAME</simple>
</setHeader>
<to uri="bean:ProcessBean?method=setProcessId" />
I am not sure that JMS_IBM_MQMD_ApplOriginData is required.