Ibm mq Spring集成队列未获取消息,但通道正在获取消息

Ibm mq Spring集成队列未获取消息,但通道正在获取消息,ibm-mq,spring-integration,spring-jms,Ibm Mq,Spring Integration,Spring Jms,在Websphere MQ中使用Spring集成将消息从一个队列传输到另一个队列 <int:logging-channel-adapter log-full-message="true" id="logger" level="INFO"/> <bean id="jmsConnectionFactory" class="com.ibm.mq.jms.MQQueueConnectionFactory"> <property name="hostName" va

在Websphere MQ中使用Spring集成将消息从一个队列传输到另一个队列

<int:logging-channel-adapter log-full-message="true" id="logger" level="INFO"/>

<bean id="jmsConnectionFactory" class="com.ibm.mq.jms.MQQueueConnectionFactory">
    <property name="hostName" value="localhost" />
    <property name="port" value="1414" />
    <property name="queueManager" value="TEST" />
    <property name="transportType" value="1" />
</bean>

<bean id="inQueue" class="com.ibm.mq.jms.MQQueue">
    <constructor-arg value="TESTQ" />
</bean>
<bean id="outQueue" class="com.ibm.mq.jms.MQQueue">
    <constructor-arg value="DEST_QUEUE" />
</bean>
<int:channel id="readFromChannel">
 <int:interceptors>
  <int:wire-tap channel="logger"/>
</int:interceptors>
</int:channel>
<int:channel id="sendToChannel" >
    <int:queue/>
<int:interceptors>
  <int:wire-tap channel="logger"/>
</int:interceptors> 
</int:channel>

<int-jms:message-driven-channel-adapter id="jmsInAdapter"
connection-factory="cachingConnectionFactory"
destination="inQueue"
channel="readFromChannel" />

<int-jms:message-driven-channel-adapter id="jmsOutAdapter"
connection-factory="cachingConnectionFactory"
destination="outQueue"
channel="sendToChannel" />


<bean id="myMessenger" class="test.MyMessenger" />     

<int:service-activator id="servAct" input-channel="readFromChannel" output-channel="sendToChannel" ref="myMessenger" method="transfer"/>
输出通道显示消息正在运行,但我无法从MQ资源管理器在队列中看到。会话如何提交?我无法停止java应用程序。如何使用连接停止优雅地停止? 我哪里做错了? 这里是上下文配置-

<int:logging-channel-adapter log-full-message="true" id="logger" level="INFO"/>

<bean id="jmsConnectionFactory" class="com.ibm.mq.jms.MQQueueConnectionFactory">
    <property name="hostName" value="localhost" />
    <property name="port" value="1414" />
    <property name="queueManager" value="TEST" />
    <property name="transportType" value="1" />
</bean>

<bean id="inQueue" class="com.ibm.mq.jms.MQQueue">
    <constructor-arg value="TESTQ" />
</bean>
<bean id="outQueue" class="com.ibm.mq.jms.MQQueue">
    <constructor-arg value="DEST_QUEUE" />
</bean>
<int:channel id="readFromChannel">
 <int:interceptors>
  <int:wire-tap channel="logger"/>
</int:interceptors>
</int:channel>
<int:channel id="sendToChannel" >
    <int:queue/>
<int:interceptors>
  <int:wire-tap channel="logger"/>
</int:interceptors> 
</int:channel>

<int-jms:message-driven-channel-adapter id="jmsInAdapter"
connection-factory="cachingConnectionFactory"
destination="inQueue"
channel="readFromChannel" />

<int-jms:message-driven-channel-adapter id="jmsOutAdapter"
connection-factory="cachingConnectionFactory"
destination="outQueue"
channel="sendToChannel" />


<bean id="myMessenger" class="test.MyMessenger" />     

<int:service-activator id="servAct" input-channel="readFromChannel" output-channel="sendToChannel" ref="myMessenger" method="transfer"/>

<int:logging-channel-adapter log-full-message="true" id="logger" level="INFO"/>

<bean id="jmsConnectionFactory" class="com.ibm.mq.jms.MQQueueConnectionFactory">
    <property name="hostName" value="localhost" />
    <property name="port" value="1414" />
    <property name="queueManager" value="TEST" />
    <property name="transportType" value="1" />
</bean>

<bean id="inQueue" class="com.ibm.mq.jms.MQQueue">
    <constructor-arg value="TESTQ" />
</bean>
<bean id="outQueue" class="com.ibm.mq.jms.MQQueue">
    <constructor-arg value="DEST_QUEUE" />
</bean>
<int:channel id="readFromChannel">
 <int:interceptors>
  <int:wire-tap channel="logger"/>
</int:interceptors>
</int:channel>
<int:channel id="sendToChannel" >
    <int:queue/>
<int:interceptors>
  <int:wire-tap channel="logger"/>
</int:interceptors> 
</int:channel>

<int-jms:message-driven-channel-adapter id="jmsInAdapter"
connection-factory="cachingConnectionFactory"
destination="inQueue"
channel="readFromChannel" />

<int-jms:message-driven-channel-adapter id="jmsOutAdapter"
connection-factory="cachingConnectionFactory"
destination="outQueue"
channel="sendToChannel" />


<bean id="myMessenger" class="test.MyMessenger" />     

<int:service-activator id="servAct" input-channel="readFromChannel" output-channel="sendToChannel" ref="myMessenger" method="transfer"/>

如果我正确理解了您的用例,那么您希望将消息从TESTQ转移到DEST_队列。但你们必须让他们都从中读取消息,但并没有人将消息放入DEST_队列

<int:logging-channel-adapter log-full-message="true" id="logger" level="INFO"/>

<bean id="jmsConnectionFactory" class="com.ibm.mq.jms.MQQueueConnectionFactory">
    <property name="hostName" value="localhost" />
    <property name="port" value="1414" />
    <property name="queueManager" value="TEST" />
    <property name="transportType" value="1" />
</bean>

<bean id="inQueue" class="com.ibm.mq.jms.MQQueue">
    <constructor-arg value="TESTQ" />
</bean>
<bean id="outQueue" class="com.ibm.mq.jms.MQQueue">
    <constructor-arg value="DEST_QUEUE" />
</bean>
<int:channel id="readFromChannel">
 <int:interceptors>
  <int:wire-tap channel="logger"/>
</int:interceptors>
</int:channel>
<int:channel id="sendToChannel" >
    <int:queue/>
<int:interceptors>
  <int:wire-tap channel="logger"/>
</int:interceptors> 
</int:channel>

<int-jms:message-driven-channel-adapter id="jmsInAdapter"
connection-factory="cachingConnectionFactory"
destination="inQueue"
channel="readFromChannel" />

<int-jms:message-driven-channel-adapter id="jmsOutAdapter"
connection-factory="cachingConnectionFactory"
destination="outQueue"
channel="sendToChannel" />


<bean id="myMessenger" class="test.MyMessenger" />     

<int:service-activator id="servAct" input-channel="readFromChannel" output-channel="sendToChannel" ref="myMessenger" method="transfer"/>
您从readFromChannel获取消息,它的意思是“从TESTQ获取消息”,但它将消息放置到sendToChannel。但它并不是说您将消息放入DEST_队列

<int:logging-channel-adapter log-full-message="true" id="logger" level="INFO"/>

<bean id="jmsConnectionFactory" class="com.ibm.mq.jms.MQQueueConnectionFactory">
    <property name="hostName" value="localhost" />
    <property name="port" value="1414" />
    <property name="queueManager" value="TEST" />
    <property name="transportType" value="1" />
</bean>

<bean id="inQueue" class="com.ibm.mq.jms.MQQueue">
    <constructor-arg value="TESTQ" />
</bean>
<bean id="outQueue" class="com.ibm.mq.jms.MQQueue">
    <constructor-arg value="DEST_QUEUE" />
</bean>
<int:channel id="readFromChannel">
 <int:interceptors>
  <int:wire-tap channel="logger"/>
</int:interceptors>
</int:channel>
<int:channel id="sendToChannel" >
    <int:queue/>
<int:interceptors>
  <int:wire-tap channel="logger"/>
</int:interceptors> 
</int:channel>

<int-jms:message-driven-channel-adapter id="jmsInAdapter"
connection-factory="cachingConnectionFactory"
destination="inQueue"
channel="readFromChannel" />

<int-jms:message-driven-channel-adapter id="jmsOutAdapter"
connection-factory="cachingConnectionFactory"
destination="outQueue"
channel="sendToChannel" />


<bean id="myMessenger" class="test.MyMessenger" />     

<int:service-activator id="servAct" input-channel="readFromChannel" output-channel="sendToChannel" ref="myMessenger" method="transfer"/>
这是因为在您的案例中,用于从JMS MQ读取消息

<int:logging-channel-adapter log-full-message="true" id="logger" level="INFO"/>

<bean id="jmsConnectionFactory" class="com.ibm.mq.jms.MQQueueConnectionFactory">
    <property name="hostName" value="localhost" />
    <property name="port" value="1414" />
    <property name="queueManager" value="TEST" />
    <property name="transportType" value="1" />
</bean>

<bean id="inQueue" class="com.ibm.mq.jms.MQQueue">
    <constructor-arg value="TESTQ" />
</bean>
<bean id="outQueue" class="com.ibm.mq.jms.MQQueue">
    <constructor-arg value="DEST_QUEUE" />
</bean>
<int:channel id="readFromChannel">
 <int:interceptors>
  <int:wire-tap channel="logger"/>
</int:interceptors>
</int:channel>
<int:channel id="sendToChannel" >
    <int:queue/>
<int:interceptors>
  <int:wire-tap channel="logger"/>
</int:interceptors> 
</int:channel>

<int-jms:message-driven-channel-adapter id="jmsInAdapter"
connection-factory="cachingConnectionFactory"
destination="inQueue"
channel="readFromChannel" />

<int-jms:message-driven-channel-adapter id="jmsOutAdapter"
connection-factory="cachingConnectionFactory"
destination="outQueue"
channel="sendToChannel" />


<bean id="myMessenger" class="test.MyMessenger" />     

<int:service-activator id="servAct" input-channel="readFromChannel" output-channel="sendToChannel" ref="myMessenger" method="transfer"/>

在您的情况下,要将消息发送到JMS到DEST_队列,您必须使用,并且没有理由将sendToChannel标记为

谢谢,我将尝试使用Thank Artem,它工作了非常感谢。。。在这篇文章中,你能告诉我如何在应用程序读取1000条消息后停止它吗{MessageChannel inChannel=MessageChannel TestJMS.context.getbeanredfromchannel;Message operation=MessageMessageBuilder。withPayload@servAct.stop.build;inChannel.sendoperation;}但是这会停止通道而不是应用程序连接。是的,因为您停止了service activator,但您确实必须停止JMS使用者。在您的例子中,这是TESTQ的一个例子。
<int:logging-channel-adapter log-full-message="true" id="logger" level="INFO"/>

<bean id="jmsConnectionFactory" class="com.ibm.mq.jms.MQQueueConnectionFactory">
    <property name="hostName" value="localhost" />
    <property name="port" value="1414" />
    <property name="queueManager" value="TEST" />
    <property name="transportType" value="1" />
</bean>

<bean id="inQueue" class="com.ibm.mq.jms.MQQueue">
    <constructor-arg value="TESTQ" />
</bean>
<bean id="outQueue" class="com.ibm.mq.jms.MQQueue">
    <constructor-arg value="DEST_QUEUE" />
</bean>
<int:channel id="readFromChannel">
 <int:interceptors>
  <int:wire-tap channel="logger"/>
</int:interceptors>
</int:channel>
<int:channel id="sendToChannel" >
    <int:queue/>
<int:interceptors>
  <int:wire-tap channel="logger"/>
</int:interceptors> 
</int:channel>

<int-jms:message-driven-channel-adapter id="jmsInAdapter"
connection-factory="cachingConnectionFactory"
destination="inQueue"
channel="readFromChannel" />

<int-jms:message-driven-channel-adapter id="jmsOutAdapter"
connection-factory="cachingConnectionFactory"
destination="outQueue"
channel="sendToChannel" />


<bean id="myMessenger" class="test.MyMessenger" />     

<int:service-activator id="servAct" input-channel="readFromChannel" output-channel="sendToChannel" ref="myMessenger" method="transfer"/>