Warm tip: This article is reproduced from serverfault.com, please click

consuming message from activemq queue using spring integration

发布于 2020-12-07 13:51:59

So I have application that sends message to activemq queue with spring integration.

 <int-feed:inbound-channel-adapter id="feedAdapter"
                                      channel="feedChannel"
                                      auto-startup="${auto.startup:true}"
                                      url="https://stackoverflow.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"/>

But now I want to create different application which consumes message from that queue and just prints it out to console with spring integration. I have made this:

  <jms:message-driven-channel-adapter id="JMSInboundAdapter" destination="inputQueue"/>

    <bean id="inputQueue" class="org.apache.activemq.command.ActiveMQQueue">
        <constructor-arg value="input.queue"/>
    </bean>

It works when I run application that sends message to queue. But it doesnt when I run message consume application. Error I get : Dispatcher has no subscribers for channel 'application.JMSInboundAdapter'.

How do I need to configure my message consumer application?
Questioner
uyuola
Viewed
0
Gary Russell 2020-12-07 22:41:07

If there is no channel on the adapter, the id becomes the channel name.

You need something to subscribe to that channel (e.g. a <service-activator inputChannel="JMSInboundAdapter" ... />).