Uploaded image for project: 'Spring Integration'
  1. Spring Integration
  2. INT-1337

Simple support for routing message payloads to listeners by type

    XMLWordPrintable

    Details

    • Type: New Feature
    • Status: Closed
    • Priority: Minor
    • Resolution: Complete
    • Affects Version/s: 2.0 M6
    • Fix Version/s: 4.2.GA
    • Component/s: Core
    • Labels:
      None

      Description

      I have the following event listener interface:

      public interface ActionListener<A extends Action> {	
          public void actionPerformed(A action);
      }
      

      And the following channel that defines source of events:

      <publish-subscribe-channel id="actionChannel" />
      

      When a Action is sent to the actionChannel, it should be routed to the interested ActionListeners. In my application, I can have many ActionListeners deployed e.g.

      public class BroadcasterBadgeAwarder implements ActionListener<EventTweetAction> { ... }
      public class NewbieBadgeAwarder implements ActionListener<SignupAction> { ... }
      

      From this, you should be able to discern any "EventTweetAction" should be routed to the BroadcasterBadgeAwarder", while any "SignupAction" should be routed to the NewbieBadgeAwarder.

      So I think I see how I can do this type of routing today with one or more payload-type-router definitions, point-to-point channels, and service-activators. But this seems like quite a lot of elements to define when all I really need is to route an Action to one or more ActionListeners by Action type. I was wondering if SI could add in simple support for this case.

        Attachments

          Activity

            People

            Assignee:
            abilan Artem Bilan
            Reporter:
            kdonald Keith Donald
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved: