Announcement Announcement Module
No announcement yet.
Overriding the standard flow Page Title Module
Move Remove Collapse
Conversation Detail Module
  • Filter
  • Time
  • Show
Clear All
new posts

  • Overriding the standard flow

    I have a parent component that is being used for standard work flow,now i am inherting it for my component,but i need to override a channel in the parent flow and do the operation and return back to flow in parent component.
    Below is the example
    Parent Flow:
    <si:channel  id='channel.a'/>
    <si:channel  id='channel.b'/>
    <si:channel  id='channel.c'/>
    <si:channel  id='channel.d'/>
    <si:transformer input-channel='input' output-channel='channel.a'/>
    <si:transformer input-channel='channel.a' output-channel='channel.b'/>
    <si:transformer input-channel='channel.b' output-channel='channel.c'/>
    <si:transformer input-channel='channel.c' output-channel='channel.d'/>
    <si:transformer input-channel='channel.d' output-channel='output'/>
    Now i want to overide the channel 'channel.a' and i want some other operation to be done and put in channel 'channel.b' i.e the line
    <si:transformer input-channel='channel.a' output-channel='channel.b'/>
    need to be overridden in my flow.


  • #2
    I Would like something mentioned in the eaipattern af detour


    • #3
      Although the detour pattern is defined under System Management, it could be considered a specialized case of a dynamic router It's a dynamic router with two states.

      Spring Integration allows you to alter the mapping table dynamically, either by adding/removing individual mappings, or by replacing the entire table (see AbstractMappingMessageRouter.setChannelMappings(). (In 2.0.x, this is in AbstractMessageRouter instead).

      So, in your application, you could add a router that normally maps all messages to channel.a and then override the mapping table to send the messages to the different channel instead.


      • #4
        Thanks Gary,
        but this is not solving problem, i may not need to specify in my parent component which channel need to be overridden but i can decide in the child if there is any deviation of the flow


        • #5
          You can either put a router as described above at each point where you want to allow the detour and reconfigure the appropriate one.

          Another alternative would be to unsubscribe the appropriate endpoint that you want to detour. Something like this

          <si:transformer id="one" input-channel='input' output-channel='channel.a'/>
          <si:transformer id="two" input-channel='channel.a' output-channel='channel.b'/>
          <si:transformer id="three" input-channel='channel.b' output-channel='channel.c'/>
          <si:transformer id="four" input-channel='channel.c' output-channel='channel.d'/>
          <si:transformer id="five" input-channel='channel.d' output-channel='output'/>
          <control-bus input-channel="control"/>
          Then, in the application that imports this file, send a <control-bus /> message to the transformer you want to detour.

          control.send(new GenericMessage<String>("@three.stop()"));
          This will unsubscribe "three" from "channel.b".

          Then, subscribe your own consumer to "channel.b".

          For this to work, you would probably want to configure your initial inbound adapter to auto-startup="false", and start it (with another control bus message) after the reconfiguration has completed,