使用 spring 集成使用来自 activemq 队列的消息
consuming message from activemq queue using spring integration
所以我的应用程序通过 spring 集成将消息发送到 activemq 队列。
<int-feed:inbound-channel-adapter id="feedAdapter"
channel="feedChannel"
auto-startup="${auto.startup:true}"
url="https://whosebug.com/feeds/question/49479712">
<int:poller fixed-rate="10000"/>
</int-feed:inbound-channel-adapter>
<int:channel id="feedChannel"/>
<int:transformer id="transformer" input-channel="feedChannel"
expression="payload.title + payload.author + '#{systemProperties['line.separator']}'"
output-channel="feedOutputChannel"/>
<int:channel id="feedOutputChannel"/>
<jms:outbound-gateway id="jmsOutGateway"
request-destination="inputQueue"
request-channel="feedOutputChannel"
requires-reply="false"/>
但现在我想创建不同的应用程序,它使用来自该队列的消息并通过 spring 集成将其打印到控制台。我做了这个:
<jms:message-driven-channel-adapter id="JMSInboundAdapter" destination="inputQueue"/>
<bean id="inputQueue" class="org.apache.activemq.command.ActiveMQQueue">
<constructor-arg value="input.queue"/>
</bean>
当我 运行 将消息发送到队列的应用程序时它起作用。但是当我 运行 消息使用应用程序时它不会。
我得到的错误:Dispatcher has no subscribers for channel 'application.JMSInboundAdapter'.
我需要如何配置我的消息消费者应用程序?
如果适配器上没有 channel
,则 id
成为通道名称。
您需要订阅该频道(例如 <service-activator inputChannel="JMSInboundAdapter" ... />
)。
所以我的应用程序通过 spring 集成将消息发送到 activemq 队列。
<int-feed:inbound-channel-adapter id="feedAdapter"
channel="feedChannel"
auto-startup="${auto.startup:true}"
url="https://whosebug.com/feeds/question/49479712">
<int:poller fixed-rate="10000"/>
</int-feed:inbound-channel-adapter>
<int:channel id="feedChannel"/>
<int:transformer id="transformer" input-channel="feedChannel"
expression="payload.title + payload.author + '#{systemProperties['line.separator']}'"
output-channel="feedOutputChannel"/>
<int:channel id="feedOutputChannel"/>
<jms:outbound-gateway id="jmsOutGateway"
request-destination="inputQueue"
request-channel="feedOutputChannel"
requires-reply="false"/>
但现在我想创建不同的应用程序,它使用来自该队列的消息并通过 spring 集成将其打印到控制台。我做了这个:
<jms:message-driven-channel-adapter id="JMSInboundAdapter" destination="inputQueue"/>
<bean id="inputQueue" class="org.apache.activemq.command.ActiveMQQueue">
<constructor-arg value="input.queue"/>
</bean>
当我 运行 将消息发送到队列的应用程序时它起作用。但是当我 运行 消息使用应用程序时它不会。
我得到的错误:Dispatcher has no subscribers for channel 'application.JMSInboundAdapter'.
如果适配器上没有 channel
,则 id
成为通道名称。
您需要订阅该频道(例如 <service-activator inputChannel="JMSInboundAdapter" ... />
)。