header enricher 设置 JMSReplyTo 字段并使用 jms 出站通道适配器发送相同的 jms 消息不起作用
header enricher to set JMSReplyTo field and sending the same jms message using jms outbound channel adpter does not work
我正在使用 jms 出站通道适配器发送 jms 消息,但在发送 jms 消息之前我将 JMSReplyTo 设置为 TEMP.Q3。
这是示例配置。
<int:channel id="OutgoingMessageChannel" />
<int:channel id="headerInputChannel" />
<int-jms:outbound-channel-adapter id="ticketOutbound" connection-factory="jmsConnectionFactory" destination-name="TEMP.Q2" channel="OutgoingMessageChannel"/>
<int:header-enricher input-channel="headerInputChannel" output-channel="OutgoingMessageChannel">
<int:header name="JMSReplyTo" value="TEMP.Q3"/>
</int:header-enricher>
上述方法不起作用,我无法看到 "JMSReplyTo" 字段设置为 "TEMP.Q3"
我知道我可以使用 jms 出站网关来做同样的事情,但我不希望它在本质上是同步的。
谁能告诉我是否可以使用 jms 出站通道适配器?
我需要采用其他方法吗?
编辑
这是新的工作配置。
<int:channel id="OutgoingMessageChannel" />
<int:channel id="headerInputChannel" />
<int-jms:outbound-channel-adapter id="ticketOutbound" connection-factory="jmsConnectionFactory" destination-name="TEMP.Q2" channel="OutgoingMessageChannel"/>
<int:header-enricher input-channel="headerInputChannel" output-channel="OutgoingMessageChannel">
<int:header name="jms_replyTo" ref="replyQueue"/>
</int:header-enricher>
<bean id="replyQueue" class="com.ibm.mq.jms.MQQueue">
<constructor-arg value=" TEMP.Q3" />
</bean>
由于 Spring 集成与许多协议交互,它不在内部使用本机 header 名称,以避免冲突。
使用
<int:header name="jms_replyTo" ref="replyQueue"/>
<bean id="replyQueue" class="org.apache.activemq.command.ActiveMQQueue">
<constructor-arg value="TEMP.Q3" />
</bean>
默认 header 映射器会将其映射到 JMSReplyTo
。
编辑:
JMSReplyTo
header必须是目的地,不能是简单的字符串;使用 ref=""
指向目的地 object(上面的 ActiveMQ 示例)。
我正在使用 jms 出站通道适配器发送 jms 消息,但在发送 jms 消息之前我将 JMSReplyTo 设置为 TEMP.Q3。
这是示例配置。
<int:channel id="OutgoingMessageChannel" />
<int:channel id="headerInputChannel" />
<int-jms:outbound-channel-adapter id="ticketOutbound" connection-factory="jmsConnectionFactory" destination-name="TEMP.Q2" channel="OutgoingMessageChannel"/>
<int:header-enricher input-channel="headerInputChannel" output-channel="OutgoingMessageChannel">
<int:header name="JMSReplyTo" value="TEMP.Q3"/>
</int:header-enricher>
上述方法不起作用,我无法看到 "JMSReplyTo" 字段设置为 "TEMP.Q3"
我知道我可以使用 jms 出站网关来做同样的事情,但我不希望它在本质上是同步的。
谁能告诉我是否可以使用 jms 出站通道适配器?
我需要采用其他方法吗?
编辑
这是新的工作配置。
<int:channel id="OutgoingMessageChannel" />
<int:channel id="headerInputChannel" />
<int-jms:outbound-channel-adapter id="ticketOutbound" connection-factory="jmsConnectionFactory" destination-name="TEMP.Q2" channel="OutgoingMessageChannel"/>
<int:header-enricher input-channel="headerInputChannel" output-channel="OutgoingMessageChannel">
<int:header name="jms_replyTo" ref="replyQueue"/>
</int:header-enricher>
<bean id="replyQueue" class="com.ibm.mq.jms.MQQueue">
<constructor-arg value=" TEMP.Q3" />
</bean>
由于 Spring 集成与许多协议交互,它不在内部使用本机 header 名称,以避免冲突。
使用
<int:header name="jms_replyTo" ref="replyQueue"/>
<bean id="replyQueue" class="org.apache.activemq.command.ActiveMQQueue">
<constructor-arg value="TEMP.Q3" />
</bean>
默认 header 映射器会将其映射到 JMSReplyTo
。
编辑:
JMSReplyTo
header必须是目的地,不能是简单的字符串;使用 ref=""
指向目的地 object(上面的 ActiveMQ 示例)。