Results 1 to 2 of 2

Thread: Nested Gateway prevents multi-threading.

  1. #1

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

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

  2. #2
    Join Date
    Mar 2010
    Location
    Gtr Philadelphia, PA
    Posts
    2,029

    Default

    Yes.

    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.
    Gary P. Russell
    Spring Integration Team
    SpringSource, a division of VMware

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •