尝试找出使用JMS设置ApplicationIdData的camel / Spring配置。
我知道java的方法,如下所示,我使用下面设置MQOO_SET_IDENTITY_CONTEXT
int putOptions = MQConstants.MQPMO_SET_IDENTITY_CONTEXT;
pmo.options =putOptions;
然后我将applicationIdData设置为:
MQMessage msg = new MQMessage();
msg.applicationIdData = "SomeId";
msg.writeString(qmessage);
queue.put(msg,pmo);
问题是,如何使用JMS / camel / Spring配置设置applicationIdData 。 以下是我目前的骆驼配置。
<bean class="org.apache.camel.component.jms.JmsComponent" id="jmsConnection">
<property name="connectionFactory" ref="mqConnectionFactoryWrapper" />
<property name="acknowledgementModeName" value="AUTO_ACKNOWLEDGE" />
</bean>
<bean id="connectionFactory" class="com.ibm.mq.jms.MQQueueConnectionFactory">
<property name="hostName" value="${HOSTMNAME}" />
<property name="port" value="${PORT}" />
<property name="queueManager" value="${MQ_QMNAME}" />
<property name="channel" value="${MQ_INTERNAL_CHANNEL}" />
<property name="transportType" value="1" />
<!-- Transport type 1 means pure TCP/IP without any local client -->
</bean>
<bean id="mqConnectionFactoryWrapper"
class="org.springframework.jms.connection.CachingConnectionFactory">
<property name="targetConnectionFactory" ref="connectionFactory" />
<property name="sessionCacheSize" value="500" />
</bean>
<bean id="jmsTransactionManager"
class="org.springframework.jms.connection.JmsTransactionManager">
<property name="connectionFactory" ref="mqConnectionFactoryWrapper" />
</bean>
<bean id="PROPAGATION_REQUIRES_NEW"
class="org.apache.camel.spring.spi.SpringTransactionPolicy">
<property name="transactionManager" ref="jmsTransactionManager" />
<property name="propagationBehaviorName" value="PROPAGATION_REQUIRES_NEW" />
</bean>
我已经通过以下链接,无法找到正确的答案
http://www.ibm.com/support/knowledgecenter/SSFKSJ_7.0.1/com.ibm.mq.csqzaw.doc/jm41030_.htm
https://www.ibm.com/support/knowledgecenter/en/SSFKSJ_9.0.0/com.ibm.mq.dev.doc/q032010_.htm
答案 0 :(得分:0)
我需要在camel配置中找到一种方法来在目标中设置一些属性并设置一些标头。我在标题中设置目的地为
&lt; setHeader headerName =&#34; CamelJmsDestinationName&#34;&gt;队列:/// Q_Name targetClient = 1&安培; mdWri teEnabled =真安培;一个熔点; mdMessageContext = 1·; /&的setHeader GT; 强>
注意:设置mdWri teEnabled = true等于
// Enable MQMD write
dest.setBooleanProperty(WMQConstants.WMQ_MQMD_WRITE_ENABLED, true);
设置mdMessageContext = 1等于
// Optionally, set a message context if applicable for this MD field
dest.setIntProperty(WMQConstants.WMQ_MQMD_MESSAGE_CONTEXT,
WMQConstants.WMQ_MDCTX_SET_IDENTITY_CONTEXT);
然后将ApplicationIdData设置为 &lt; setHeader headerName =&#34; JMS_IBM_MQMD_ApplIdentityData&#34; &GT; BSI_XML_CANADA_ACK BSI_XML_CANADA_ACK&lt; / setHeader&gt;
完整代码:
<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" />
我不确定是否需要JMS_IBM_MQMD_ApplOriginData。