Announcement Announcement Module
No announcement yet.
Sync & Async subscribers on the same channel ? Page Title Module
Move Remove Collapse
Conversation Detail Module
  • Filter
  • Time
  • Show
Clear All
new posts

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


    • #3
      Thanks Oleg

      I have created a ticket for the same


      • #4
        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.
        <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.