Announcement Announcement Module
No announcement yet.
Dynamic Router Support Page Title Module
Move Remove Collapse
Conversation Detail Module
  • Filter
  • Time
  • Show
Clear All
new posts

  • Dynamic Router Support

    I'm trying to determine how best to implement the Dynamic Router pattern using Spring Integration as described here.

    The best I can see so far from searching the forums was to use one of the subclasses of AbstractChannelNameResolvingMessageRouter and implement a ChannelResolver.

  • #2
    I would say it depends on the complexity of your routing requirement.
    Dynamic router support was present in SI since its inception and was continuously improved.
    For example:
    We have use-case specific routers such as header-value-router or payload-type-router. Obviously they don't fall in the category of Dynamic Routers.
    However, we also provide XML and annotation support for a generic router which is backed up by a POJO class that you have to implement (no need to extend anything from SI).
    We also provide support for addressing Dynamic Router requirement s via Spring Expression Language (SpEL) where router element can specify 'expression' attribute which would return a channel or a collection of channels which essentially means that a Dynamic Router can be a content based router and recipient list router at the same time.
    So maybe you should elaborate a little more about your specific use case and we'll take it from there.


    • #3
      We want a dynamic payload type router where we send the rules for the dynamic routing to the router at runtime. For instance, at runtime send the router a new rule on the control channel saying:

      "Here's a new payload type. Send all messages with a payload of this type of a specific channel (this channel would need to be created a runtime as well)."


      • #4
        Great! We have exactly that. Have you looked at the ControlBus functionality provided in SI?
        ControlBus support is a JMX wrapper which essentially allows you to define an adapter which is really a 'control channel' you are talking about. It will accept a control message mapping it to a managed operation of your choice (in this case the router bean would expose managed operation)
        To make it simpler I've compiled a quick test case on which you can expend.
        Its located here:

        The file of interests are:


        • #5
          Also, we just had a discussion on that and we are now going to expose addChannelMapping method on the payload-type-router and possibly header-value-router so these routers themselves become dynamic.
          You can watch this JIRA


          • #6
            I haven't had a chance to try the new dynamic router support yet, but I've read the documentation for 2.0 and the JIRA ticket and would like to thank all contributors for their excellent support on meeting the community's needs.