Results 1 to 5 of 5

Thread: Splitter + Router

  1. #1
    Join Date
    May 2011
    Location
    Cracow, Poland
    Posts
    53

    Default Splitter + Router

    Hi!

    Imagine scenario:

    I have a message with a list of different kind of data (list with some kind of POJO). I would like to split that message (iterate over the list) and then route (depends on the kind of data) to different channels...Is there any way to do that?

  2. #2
    Join Date
    Jan 2009
    Location
    Ukraine, Kharkov
    Posts
    632

    Default

    Hello.
    Maybe this is enough?
    HTML Code:
    <payload-type-router input-channel="routingChannel">
      <mapping type="java.lang.String" channel="stringChannel" />
      <mapping type="java.lang.Integer" channel="integerChannel" />
    </payload-type-router>
    You determine the outbound channel on pyload type

    Nevertheless you can implement your own logic in custom router.
    Please, read this: http://static.springsource.org/sprin...outing-chapter

    Artem
    Last edited by Cleric; May 31st, 2011 at 03:14 AM.

  3. #3
    Join Date
    May 2011
    Location
    Cracow, Poland
    Posts
    53

    Default

    But I want to slice the payload to smaller messages (each having it's own type) and then (depends on type) send it to some kind of component...

  4. #4
    Join Date
    Jan 2009
    Location
    Ukraine, Kharkov
    Posts
    632

    Default

    But this is your solution:
    HTML Code:
     <channel id="input"/>
     <channel id="router">
       </queue/>
    </channel>
       <splitter id="splitter"  ref="splitterBean"  method="split" input-channel="input" output-channel="router"/>
     
     <payload-type-router input-channel="input">
             <mapping type="java.lang.String" channel="stringChannel" />
             <mapping type="java.lang.Integer" channel="integerChannel" />
       </payload-type-router>
    Your splitter partitions message and sends each part to async channel for router.
    Last edited by Cleric; May 31st, 2011 at 06:42 AM.

  5. #5
    Join Date
    May 2011
    Location
    Cracow, Poland
    Posts
    53

    Default

    Thanks for Your reply...I've managed to do it in a way that You described in the post...

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •