How to set ApplicationIdData using MQQueueConnectionFactory?

后端 未结 1 633
难免孤独
难免孤独 2021-01-27 04:07

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

相关标签:
1条回答
  • 2021-01-27 04:51

    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&mdWri‌​teEnabled=true&a‌​mp;mdMessageContext=‌​1</setHeader>

    Note: Setting mdWri‌​teEnabled=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&amp;mdWriteEnabled=true&amp;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.

    0 讨论(0)
提交回复
热议问题