Announcement Announcement Module
No announcement yet.
Nested Gateway prevents multi-threading. Page Title Module
Move Remove Collapse
Conversation Detail Module
  • Filter
  • Time
  • Show
Clear All
new posts

  • Nested Gateway prevents multi-threading.

    I have a nested gateway in a chain which gives an entry point to a channel with a task-executor attach to it. I would have expect to have parallel treatement at this point, but no. Does the gateway waits for a reply before processing the next message?

    <!--With 5 Threads!>
    <channel id="parallelTxChannel">
    	<dispatcher task-executor="asmTxExecutor" />
    <chain input-channel="tcpInputChannel">
    	<splitter ref="splitter"/>
    	<gateway request-channel="parallelTxChannel"  />
    	<aggregator ref="aggregator" />
    <chain input-channel="parallelTxChannel">

  • #2

    By definition, all the channels "within" a gateway are direct channels; the thread entering the first <chain/> has to complete all the work in that chain. It will block until the gateway returns, regardless any multi-threading downstream of the gateway. Each of the splits runs on the same thread. The same would occur outside of a chain, if the splitter and gateway were connected by an explicit DirectChannel.

    You need to add some asynchrony between the splitter and gateway in order to get parallelism there; this can't be done in a chain. You can either use a <queue/> channel between the splitter and gateway, or use a direct channel with a dispatcher that has a <task-executor/>.

    See the reference manual for more info, especially transactional considerations.