服务激活器或监听器 - 容器

时间:2015-10-19 21:36:56

标签: spring-integration spring-amqp

我正在使用Spring AMQP和Spring Integration。我目前正在使用集成中的服务激活器作为我的处理程序。我试图让amqp监听器工作,但我从未收到过该消息。是使用服务激活器接受的练习还是我应该使用听众?

<!-- Receive Inbound messages and process them -->
<int-amqp:inbound-channel-adapter channel="sda.text.analytics.process.channel" queue-names="${sda.text.analytics.process.queue}"
    connection-factory="sda.text.analytics.connectionFactory" prefetch-count="${sda.mule.prefetchCount}"
    concurrent-consumers="${uima.process.threads}" task-executor="analyticsExecutor" receive-timeout="5000"/>

<int:json-to-object-transformer input-channel="sda.text.analytics.process.channel" type="com.issinc.sda.ingest.impl.IngestBean"/>

<bean id="analyticsExecutor" class="org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor">
    <property name="corePoolSize" value="${uima.process.threads}" />
    <property name="maxPoolSize" value="${uima.process.threads}" />
    <property name="queueCapacity" value="${sda.mule.prefetchCount}" />
</bean>

<!-- Service that listens for an inbound messages, processes the text and sends the processed text back -->
<int:service-activator input-channel="sda.text.analytics.process.channel" output-channel="sda.text.analytics.response.channel"
   ref="asyncExtractionService" method="processMessage" >
</int:service-activator>
<!--<rabbit:listener-container connection-factory="sda.connectionFactory" message-converter="jsonMessageConverter">
    <rabbit:listener ref="asyncExtractionService" method="processMessage" queue-names="${sda.process.queue}" />
</rabbit:listener-container>-->

1 个答案:

答案 0 :(得分:0)

你根本就没有真正“使用”服务激活器;您正在调用与服务激活器相同的bean /方法。

考虑使用AMQP入站通道适配器通过nodetool status向服务激活器发送消息。