2
votes

I have a heavy loaded (allot of external network calls) integration flow, which uses PriorityQueue before entering main Service Activator. I want to add executor channel to improve the system load, but I see no straight forward ways to combine those channels.

<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>

I needed to create 2 additional components, to make this work, but is there a way to combine few Spring Integration Channels in one, without adding new components?

1

1 Answers

2
votes

Actually, looks like not ebough info. But I try to guess. You need this:

<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>

Here you use a Bridge to shift messages from one channel to another one.

OR this:

<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>

Here you just place your messages from priorityChannel to taskExecutor using Poller.

It is abnormal to mix concerns in one channel. Each channel type plays his own concreate role. What you want to achieve is not just minimize typing, but even if that happen to be a solution for you, it would be very complex and not robust.