Spring integration Spring与JMS支持的渠道的集成;Dispatcher没有订户”;

Spring integration Spring与JMS支持的渠道的集成;Dispatcher没有订户”;,spring-integration,spring-jms,Spring Integration,Spring Jms,我是Spring集成的新手,正在尝试使用SI和ActiveMQ执行一个非常基本的生产者/消费者应用程序 我看到消息被生成并存储在队列中,但当使用者(本例中为service activator)处理该消息并尝试将新消息返回到输出通道时,我不断收到以下警告消息: 11:28:14.425 WARN [DefaultMessageListenerContainer-1][org.springframework.jms.listener.DefaultMessageLis tenerContainer]

我是Spring集成的新手,正在尝试使用SI和ActiveMQ执行一个非常基本的生产者/消费者应用程序

我看到消息被生成并存储在队列中,但当使用者(本例中为service activator)处理该消息并尝试将新消息返回到输出通道时,我不断收到以下警告消息:

11:28:14.425 WARN [DefaultMessageListenerContainer-1][org.springframework.jms.listener.DefaultMessageLis tenerContainer] Execution of JMS message listener failed, and no ErrorHandler has been set.
org.springframework.integration.MessageDeliveryExc eption: Dispatcher has no subscribers for jms-channel jsonResponseChannel.
at org.springframework.integration.jms.SubscribableJm sChannel$DispatchingMessageListener.onMessage(Subs cribableJmsChannel.java:159)

Below is the snapshot of my context xmls :

common-context.xml
---------------------
..............
<bean id="requestQueue" class="org.apache.activemq.command.ActiveMQQueue">
<constructor-arg value="INPUT_MSG_QUEUE" />
</bean>
<bean id="responseQueue" class="org.apache.activemq.command.ActiveMQQueue">
<constructor-arg value="OUTPUT_MSG_QUEUE" />
</bean>
<int-jms:channel id="jsonGreetingRequests" queue-name="INPUT_MSG_QUEUE" message-driven="true"/>
<int-jms:channel id="jsonResponseChannel" queue-name="OUTPUT_MSG_QUEUE" message-driven="true"/>
<bean name="connectionFactory" class="org.apache.activemq.ActiveMQConnectionFacto ry">
<property name="brokerURL" value="tcp://localhost:61616" />
</bean>
..............

consumer-context.xml
---------------------
.............

<int-jms:message-driven-channel-adapter id="newRequestsInChannelAdapter" destination="requestQueue" channel="jsonGreetingRequests"/>
<!-- <int-jms:inbound-gateway request-channel="jsonGreetingRequests" reply-channel="jsonResponseChannel" request-destination="requestQueue" />-->

<int:chain input-channel="jsonGreetingRequests" output-channel="jsonResponseChannel">
<int:json-to-object-transformer type="com.periscope.samples.service.Message"/>
<int:service-activator method="greetHello">
<bean class="com.periscope.samples.service.impl.HelloWor ldServiceImpl"/>
</int:service-activator>
<int:object-to-json-transformer />
</int:chain>

<stream:stdout-channel-adapter id="greetingsStdOut" channel="jsonResponseChannel"/>
.....................

producer-context.xml
-----------------------
.....
<int:gateway id="greetings"
default-request-channel="greetingRequests"
service-interface="com.periscope.samples.service.Greetings "/>
<int:channel id="greetingRequests"/>

<int:chain input-channel="greetingRequests" output-channel="jsonGreetingRequests">
<int:object-to-json-transformer />
</int:chain>

<int-jms:outbound-channel-adapter id="jmsGreetingsOutChannelAdapter" channel="jsonGreetingRequests" destination="requestQueue"/>
.......

您不需要jms通道适配器和jms支持的队列

在当前配置中,输入消息队列上有两个使用者(通道和通道适配器)

jms支持的通道实际上仅用于消息持久性。要将消息发送到其他应用程序,请使用适配器

只要改变这些

<int-jms:channel id="jsonGreetingRequests" queue-name="INPUT_MSG_QUEUE" message-   driven="true"/>
<int-jms:channel id="jsonResponseChannel" queue-name="OUTPUT_MSG_QUEUE" message-driven="true"/>

要简化
s

另外,考虑到您正在使用请求/响应语义,从
开始,您需要使用jms入/出网关,而不是适配器(用于单向集成)

<int-jms:channel id="jsonGreetingRequests" queue-name="INPUT_MSG_QUEUE" message-   driven="true"/>
<int-jms:channel id="jsonResponseChannel" queue-name="OUTPUT_MSG_QUEUE" message-driven="true"/>