Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9096337
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T23:49:14+00:00 2026-06-16T23:49:14+00:00

I am new in Spring integration and working on a SI project. I am

  • 0

I am new in Spring integration and working on a SI project. I am doing a simple job of getting message from a channel (fromAdapter), calling a transformer and sending the output to another channel (toQueue). The below code is used in the SI configuration file —-

<int:channel id="fromAdapter"></int:channel>
<int:channel id="toQueue">  
</int:channel>  
<bean id="trans" class="src.MyTransformer"></bean>  
<int:transformer input-channel="fromAdapter" output-channel="toQueue" ref="trans"></int:transformer>

However, now I have a slightly complex requirement. Instead of always sending the message to one transformer,based on some value of the message, I want to send the message to any one of 6 transformers. How can this be implemented?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-16T23:49:15+00:00Added an answer on June 16, 2026 at 11:49 pm

    You can declare those 6 transformers as subscribers to a single point-to-point channel and by default it will use a round robin dispatching strategy (it will only invoke a single transformer for each message, but it will always pick the next transformer in the list and then cycle).

    In your case, you should simply declare all those transformers to use the exact same input and output channels and the above will automagically happen.


    To pick the transformer based on some attribute of your message, you can use a recipient-list-router and define a selector-expression for each recipient in the list in order to match a particular kind of message. Also, for each recipient you should use a different channel name. Then each of those channels will be used as input by the desired transformer:

    <recipient-list-router input-channel="fromAdapter" default-output-channel="toQueue">
        <recipient channel="t1" selector-expression="payload.someFlag"/>
        <recipient channel="t2" selector-expression="headers.someOtherFlag"/>
    </recipient-list-router>
    
    <transformer input-channel="t1" ref="transformer1" method="transform"/>
    <transformer input-channel="t2" ref="transformer2" method="transform"/>
    

    Keep in mind that with this approach, a message could match more than one selector expression so it’s up to you to provide mutually exclusive expressions.

    Or, if you are willing to write some infrastructure code, you can write your own implementation of LoadBalancingStrategy and provide that to your point-to-point channel. Your strategy will then be responsible for picking the right handler for each message.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm currently working with MyBatis-Spring integration framework and that's what I read from docs:
I am new to Spring Integration. I've configured a Spring file inbound-channel-adapter, e.g. <file:inbound-channel-adapter
i am new in integration of jsf 2.0 spring 3.1 and hibernate 4.1. how
New to spring. I'm getting the following exception being caught: 2012-06-14 16:20:57,719 [http-8080-6] ERROR
I am new to spring MVC. i have below project structure. Below are classes:
I'm currently working on an integration project to connect two disparate systems. My plan
I am fairly new to Spring and am working with a suite of JUnit
I'm working on a Spring MVC project, and I have unit tests for all
Part of a project I'm working on (Windows, C#, MVC4 WebAPI) requires some integration
I'm currently on learning integration of Spring + Hibernate, and so far I'm getting

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.