2015-10-19 52 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)。 –