簡體   English   中英

使用 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://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"/>

但是現在我想創建不同的應用程序,它使用來自該隊列的消息,並通過 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"... /> )。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM