2
我想閱讀RabbitMQ隊列中的消息>使用Service-Activator調用服務。SpringIntegration:Service-Activator未調用方法
相關配置部分:
<int-amqp:inbound-channel-adapter channel="fromRabbit" queue-names="si.test.queue" mapped-request-headers="whatever"
connection-factory="connectionFactory" />
<int:service-activator input-channel="fromRabbit" output-channel="whatever"
ref="msgService" method="checkMsg"/>
<bean id="msgService" class="com.whatever.MsgService"/>
的MsgService類是:
public class MsgService{
//Does not work!
public void checkMsg(@Payload String s) {
System.out.println("The Payload is: " +s);
}
}
,但我得到以下錯誤信息:
... 引起:java.lang.IllegalArgumentException異常:[class org.springframework.integration.service.MessageExaminer]類型的目標對象沒有合適的方法來處理消息。
我在這做錯了什麼?
但如果我只是用這個作爲ServiceMsg類中的方法 - 的作品:
public void seeMessage(String m)
{
System.out.println(m);
}
我的目標是獲得消息本身,負載和標頭在服務的激活方法的保持。