我可以使用收件人列表路由器從HTTP入站端點路由到2個JMS隊列嗎?我的目標是將來自HTTP入站端點的消息路由到2個jms隊列,即訂單和項目隊列。我想使用收件人列表路由器來執行此操作。我不想使用pub pub子頻道解決方案。使用收件人列表路由器路由到JMS隊列
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:context="http://www.springframework.org/schema/context"
xmlns:int="http://www.springframework.org/schema/integration"
xmlns:int-http="http://www.springframework.org/schema/integration/http"
xmlns:int-jms="http://www.springframework.org/schema/integration/jms"
xsi:schemaLocation="
http://www.springframework.org/schema/context
http://www.springframework.org/schema/context/spring-context.xsd
http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans.xsd
http://www.springframework.org/schema/integration
http://www.springframework.org/schema/integration/spring-integration.xsd
http://www.springframework.org/schema/integration/jms
http://www.springframework.org/schema/integration/jms/spring-integration-jms.xsd
http://www.springframework.org/schema/integration/http
http://www.springframework.org/schema/integration/http/spring-integration-http.xsd">
<import resource="queue-config.xml" />
<int:channel id="productChannel"/>
<int:channel id="jmsIn1">
<int:queue/>
</int:channel>
<int:channel id="jmsIn2">
<int:queue/>
</int:channel>
<!-- Want the orders from this endpoint to be placed in queues-->
<!-- Doesn't work even without <queue/> -->
<int-http:inbound-gateway supported-methods="PUT,POST"
path="/products/order" request-channel="productChannel">
</int-http:inbound-gateway>
<int:chain input-channel="productChannel">
<int:recipient-list-router id="jmsRouter">
<int:recipient channel="jmsIn1" />
<int:recipient channel="jmsIn2" />
</int:recipient-list-router>
<int:service-activator ref="orderHandler"
method="addOrder"/>
</int:chain>
<bean id="orderHandler" class="com.jms.OrderHandler" />
<int-jms:outbound-channel-adapter id="product.outbound.channel"
channel="jmsIn1" destination="orders.queue" />
<int-jms:outbound-channel-adapter id="records.outbound.channel"
channel="jmsIn2" destination="items.queue" />
</beans>
我嘗試使用收件人列表使用jms出站適配器,但我得到以下exceptionorg.springframework.beans.factory.BeanCreationException:創建bean智慧錯誤 h name'org.springframework.integration.handler.MessageHandlerChain#0':初始化方法的Invocati 失敗;嵌套的例外是java.lang.IllegalArgumentException異常 :除了最後一個鏈必須實現MessagePr oducer接口的所有處理器。類[org.springframework.integration.router.Recipi entListRouter]的對象必須是接口org.springframework.integration的實例。 core.MessageProducer – BreenDeen
的目標是:處理I增加了更多的清晰度和一些代碼的消息 – BreenDeen