Apache camel 如何使用MQQueueConnectionFactory设置ApplicationIData?
试图找出camel/Spring配置,以使用JMS设置ApplicationIdData 我知道下面的java方法,我使用下面的方法设置MQOO_set_IDENTITY_上下文Apache camel 如何使用MQQueueConnectionFactory设置ApplicationIData?,apache-camel,ibm-mq,spring-jms,Apache Camel,Ibm Mq,Spring Jms,试图找出camel/Spring配置,以使用JMS设置ApplicationIdData 我知道下面的java方法,我使用下面的方法设置MQOO_set_IDENTITY_上下文 int putOptions = MQConstants.MQPMO_SET_IDENTITY_CONTEXT; pmo.options =putOptions; 然后我将applicationIData设置为: MQMessage msg = new MQMessage(); msg.applicationIdD
int putOptions = MQConstants.MQPMO_SET_IDENTITY_CONTEXT;
pmo.options =putOptions;
然后我将applicationIData设置为:
MQMessage msg = new MQMessage();
msg.applicationIdData = "SomeId";
msg.writeString(qmessage);
queue.put(msg,pmo)
问题是,如何使用JMS/camel/Spring配置设置applicationIdData。
下面是我当前的camel配置
<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>
我已经通过下面的链接,找不到正确的答案
我只需要在camel config中找到一种方法,在目的地中设置一些属性并设置一些标题。我将标题中的目的地设置为 queue:///Q_Name?targetClient=1&mdWriteEnabled=true&a议员;mdMessageContext=1 注:设置mdWriteEnabled=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);
然后将applicationIData设置为
BSI\U XML\U CANADA\U ACK BSI\U XML\U CANADA\U ACK
完整代码:
<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" />
queue:///Q_Name?targetClient=1&mdWriteEnabled=为真&;mdMessageContext=1
真的
2.
应用程序\u ID\u名称
应用程序\u ID\u名称
我不确定是否需要JMS\u IBM\u MQMD\u ApplOriginData。我需要在camel config中找到一种方法,在目标中设置一些属性并设置一些头。我将标题中的目的地设置为 queue:///Q_Name?targetClient=1&mdWriteEnabled=true&a议员;mdMessageContext=1 注:设置mdWriteEnabled=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);
然后将applicationIData设置为
BSI\U XML\U CANADA\U ACK BSI\U XML\U CANADA\U ACK
完整代码:
<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" />
queue:///Q_Name?targetClient=1&mdWriteEnabled=为真&;mdMessageContext=1
真的
2.
应用程序\u ID\u名称
应用程序\u ID\u名称
我不确定是否需要JMS\u IBM\u MQMD\u ApplOriginData。
queue.put(msg,pmo)
看起来像是JMS的扩展,因此无法使用标准JMS API—因此我猜Spring JMS不可能使用它,除非有其他后门方法(例如,通过消息头)。谢谢Gary,但我认为应该有一些方法/解决方法。将继续尝试…IBM提出了一种将其设置为属性的方法,尝试它[IBM的建议]()queue.put(msg,pmo)
看起来像是JMS的扩展,因此无法使用标准JMS API—因此我猜Spring JMS不可能使用它,除非有其他后门方法(例如,通过消息头)。谢谢Gary,但我认为应该有一些方法/解决方法。将继续尝试…IBM提出了一种将其设置为属性的方法,正在尝试[IBM的建议]()