0
我想將以下內容轉換爲spring-integration java dsl。使用Java DSL設置pub-sub-domain
<int:channel id="partsSubscriberChannel" />
<int-jms:message-driven-channel-adapter
id="jmsPartsInbound"
acknowledge="transacted"
destination-name="parts.topic"
channel="partsSubscriberChannel"
pub-sub-domain="true"
connection-factory="jmsConnectionFactory"/>
這是我最高:
@Bean
public MessageChannel partsErrorChannel() {
return new DirectChannel();
}
@Bean
public MessageChannel partsSubscriberChannel() {
return new DirectChannel();
}
@Bean
public IntegrationFlow partsSubscription(ConnectionFactory connectionFactory) {
return IntegrationFlows
.from(Jms.messageDriverChannelAdapter(connectionFactory)
.id("partsJmsSubscriber")
.destination(Topic.PARTS.getName())
.outputChannel(partsSubscriberChannel())
.errorChannel(partsErrorChannel()))
.get();
}
如何設置pub-sub-domain
和acknowledge
XML屬性?
感謝,並AbstractMessageListenerContainer類需要一個@Bean?原因是我將創建許多不同的主題,所以Topic.PARTS.getName()會傳遞一個參數。 – jax
不,它不會,只要您不需要稍後將其作爲參考(例如在運行時更改併發消費者等)。順便說一下,我之前創建了一個[拉請求](https://github.com/spring-projects/spring-integration-java-dsl/pull/41),以將工廠方法添加到'Jms'來構建容器。但是,在將它集成到發行版之前還有一段時間。 –
我現在實際上在類[javax.jms.Session]'中找不到'org.springframework.core.ConstantException:Field'AUTO'。 – jax