如何"翻译"以下XML配置为等效的Spring集成java-dsl?
<int:publish-subscribe-channel id="channel" task-executor="myex">
</int:publish-subscribe-channel>
<task:executor id="myex" pool-size="10"></task:executor>
我已阅读DSL Reference Guide,但仍无法弄明白。
答案 0 :(得分:2)
MessageChannels章指出MessageChannels
工厂。因此,<publish-subscribe-channel>
XML配置转换为Java配置,如:
@Bean
public MessageChannel channel() {
return MessageChannels.publishSubscribe(myExecutor()).get();
}
虽然您可以使用原始Java配置达到相同的目的:
@Bean
public MessageChannel channel() {
return new PublishSubscribeChannel(myExecutor());
}