How to declare two outbound adapters to publish another message

I have declared int: a chain with only one input and output channels,

<int:chain input-channel="InputChannel" output-channel="Channel">

      <int:transformer method = "transform" >
        <bean class="com.sampleconverter" />
      </int:transformer>
        <int:service-activator method="transform">
             <bean class="com.Transformer" />
        </int:service-activator>
     <int:object-to-string-transformer />
   </int:chain>

      

How to declare multiple output channels each with different conversion methods (different messages)

Thank you in advance

+3


source to share


1 answer


Only one component in Spring Integration has multiple outputs - router

.

So, you can set it up at the end chain

and let it decide which channel to send the message to on the provided condition.

For example:



<payload-type-router>
    <mapping type="java.lang.String" channel="strings"/>
    <mapping type="java.lang.Number" channel="numbers"/>
</payload-type-router>

      

More information in the reference manual and in Samples .

0


source







All Articles