Results 1 to 4 of 4

Thread: Sync & Async subscribers on the same channel ?

  1. #1
    Join Date
    Nov 2008
    Location
    London,UK
    Posts
    299

    Default Sync & Async subscribers on the same channel ?

    I have a requirement where i need some of the subscribers (say A and B) to be synchronously called where as the other subscribers (say C and D )need to be asynchronous.

    So what i am trying to say is does the subscriber have any way of saying if its sync or async ? or its always the property of channel(through task executors)

    Is this possible in a single channel ?

    With multiple channels i have a solution. I make independent syn and async channels and let the subscriber s connect to teh respective channels.

  2. #2
    Join Date
    Jan 2008
    Location
    Mohnton, PA USA (that's near Philadelphia)
    Posts
    2,148

    Default

    Distributing messages synchronously or asynchronously is currently the responsibility of the MessageDispatcher which defines task-executor.
    However, what you are proposing is essentially to move the task-executor to the subscribers, which is interesting and requires more thought.
    Please open a JIRA feature request and we'll take a look at it
    Cheers

  3. #3
    Join Date
    Nov 2008
    Location
    London,UK
    Posts
    299

    Default

    Thanks Oleg

    I have created a ticket for the same

    http://jira.springframework.org/browse/INT-784

  4. #4
    Join Date
    May 2007
    Location
    Netherlands
    Posts
    614

    Default

    There are two ways you can do this with current functionality. First you can use a separate channel for C and D and use a bridge.
    Code:
    <channel id="input">
    <service-activator id="A" input-channel="input" .../>
    <service-activator id="B" input-channel="input" .../>
    <bridge input-channel="input" output-channel="async"/>
    <channel id="async" task-executor="pool" />
    <.. "C" />
    <.. "D" />
    You can also look beyond Spring Integration and use @Async (supported in Spring 3.0) for example to do asynchronous handoff in the services themselves.

Posting Permissions

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