Router

After transforming the messages to appropriate formats, the transformers put the message on to the channel transformedChannel. We have three type of messages that will be processed by different endpoints. We can use the payload router that will route it to different components based on the payload type:

    <int:payload-type-router input-channel="transformedChannel" 
      default-output-channel="logChannel">
    <int:mapping type="com.cpandey.siexample.pojo.SoFeed"
      channel="jdbcChannel" />
    <int:mapping type="java.lang.String" 
      channel="jmsChannel" />
    <int:mapping type="org.springframework.mail.MailMessage" 
      channel="mailChannel" />
    </int:payload-type-router>

Get Spring Integration Essentials now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.