我有一个负载很重的集成流(分配外部网络调用),它在进入主服务激活器之前使用PriorityQueue。我想增加执行器通道来改善系统负载,但我没有看到直接的方式组合这些通道。
<int:channel id="monitorInPriorityUpdate">
<int:priority-queue/>
</int:channel>
<int:transformer id="monitorLogTransformerStub"
input-channel="monitorInPriorityUpdate" output-channel="monitorInUpdate"
expression="payload" />
<int:channel id="monitorInUpdate">
<int:dispatcher task-executor="monitorExecutor"/>
</int:channel>我需要创建两个额外的组件来完成这项工作,但是有没有一种方法可以将几个Spring集成通道组合在一起,而不添加新的组件呢?
发布于 2013-12-10 09:24:28
实际上,看上去不像是在消失信息。但我试着猜。你需要这个:
<int:channel id="priorityChannel">
<int:priority-queue/>
</int:channel>
<int:bridge input-channel="priorityChannel" output-channel="executorChannel">
<int:poller fixed-rate="100"/>
</int:bridge>
<int:channel id="executorChannel">
<int:dispatcher task-executor="threadPoolExecutor"/>
</int:channel>在这里,您使用桥将消息从一个通道转移到另一个通道。
或者这个:
<int:channel id="priorityChannel">
<int:priority-queue/>
</int:channel>
<int:service-activator input-channel="priorityChannel" ref="service">
<int:poller fixed-rate="100" task-executor="threadPoolExecutor"/>
</int:service-activator>在这里,您只需使用Poller将消息从priorityChannel放置到taskExecutor。
在一个通道中混合关注点是不正常的。每一种信道类型都扮演着自己的组合角色。您想要实现的不仅仅是最小化输入,而且即使这恰好是一个解决方案,它将是非常复杂和不健全的。
https://stackoverflow.com/questions/20487264
复制相似问题