【发布时间】:2015-07-29 07:02:26
【问题描述】:
我在 spring-boot application.properties 中有一个队列和主题设置,如下所示:
spring.hornetq.embedded.queues=parts.queue
spring.hornetq.embedded.topics=parts.topic
我需要从一个应用程序向另一个应用程序发送消息。
app1 (publisher)
app2 (subscriber)
bridge (contains the integration code)
我从 app1 发布的部分如下:
this.jmsTemplate.convertAndSend("parts.queue", message);
在桥接项目中,我在queue 上获取它,然后将其路由到topic。
<int:channel id="partsChannel" />
<int-jms:message-driven-channel-adapter
id="jmsPartsInbound"
acknowledge="transacted"
destination-name="parts.queue"
channel="partsChannel"
connection-factory="jmsConnectionFactory"
/>
<int-jms:outbound-channel-adapter
id="jmsPartsOutbound"
destination-name="parts.topic"
channel="partsChannel"
connection-factory="jmsConnectionFactory"
pub-sub-domain="true"
>
<int-jms:request-handler-advice-chain>
<int:retry-advice max-attempts="3">
<int:exponential-back-off initial="2000" multiplier="2" />
</int:retry-advice>
</int-jms:request-handler-advice-chain>
</int-jms:outbound-channel-adapter>
app2 然后订阅parts.topic 并处理消息。
这是可行的,但是,上面的桥接代码似乎对于我正在尝试做的事情来说可能是一种矫枉过正。我猜我只需要一个parts.topic 而根本不需要parts.queue。
上面的spring-integration XML可以用某种方式简化吗?
【问题讨论】:
标签: spring-integration hornetq