使用Java DSL设置pub-sub-domain

时间:2015-07-28 07:13:51

标签: spring-integration

我正在尝试将以下内容转换为spring-integration java dsl。

<div ng-repeat="(key, line) in items track by $index">
  <input ng-model="line.phone[key]" ng-keydown="addItem($index)"/>
</div>

这就是我要做的:

   <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 xml属性?

1 个答案:

答案 0 :(得分:0)

目前无法直接使用DSL,但您可以使用属性集连接侦听器容器...

@Bean
public IntegrationFlow jmsMessageDriverFlowWithContainer() {
    return IntegrationFlows
            .from(Jms.messageDriverChannelAdapter(container())
                    .id("foo"))
                    .errorChannel(errorChannel()))
            .channel(outputChannel()
            .get();
}

@Bean
public AbstractMessageListenerContainer container() {
    DefaultMessageListenerContainer container = new DefaultMessageListenerContainer();
    container.setSessionTransacted(true);
    container.setDestinationName(Topic.PARTS.getName());
    container.setPubSubDomain(true);
    return container;
}