2015-10-19 50 views
1

我正在使用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>--> 

回答

0

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

考虑使用AMQP入站通道适配器通过sda.process.channel将消息发送到服务激活器。

+0

谢谢加里。我有一个通道适配器: dbmargo

+0

正如您所见, code/config在这里的注释中不能很好地呈现。最好编辑你的问题。你队列中有消息吗?你的房产是否正确?通常,打开调试日志记录将提供足够的信息来调试像这样的问题。 –

+0

你还应该看看[示例](https://github.com/spring-projects/spring-integration-samples/tree/master/basic/amqp)。 –