You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by serega <se...@sybase.com> on 2011/01/11 19:51:28 UTC
RoutingSlip and Splitter
I have the following use case.
A message needs to go through a sequence of steps not known during design
time, and finally goes out to some JMS queue, also not known at desing time.
A RoutingSlip design pattern fits to this use case. But, some messages _may_
need to be split before going out to the queue.
Is it possible to have a splitter as one of the steps in the RoutingSlip?
Thanks,
Sergey
--
View this message in context: http://camel.465427.n5.nabble.com/RoutingSlip-and-Splitter-tp3337040p3337040.html
Sent from the Camel - Users mailing list archive at Nabble.com.
Re: RoutingSlip and Splitter
Posted by Claus Ibsen <cl...@gmail.com>.
On Tue, Jan 11, 2011 at 7:51 PM, serega <se...@sybase.com> wrote:
>
> I have the following use case.
> A message needs to go through a sequence of steps not known during design
> time, and finally goes out to some JMS queue, also not known at desing time.
> A RoutingSlip design pattern fits to this use case. But, some messages _may_
> need to be split before going out to the queue.
> Is it possible to have a splitter as one of the steps in the RoutingSlip?
>
No, you can only send to endpoint uris with the routing slip, dynamic
router, recipient list.
> Thanks,
> Sergey
> --
> View this message in context: http://camel.465427.n5.nabble.com/RoutingSlip-and-Splitter-tp3337040p3337040.html
> Sent from the Camel - Users mailing list archive at Nabble.com.
>
--
Claus Ibsen
-----------------
FuseSource
Email: cibsen@fusesource.com
Web: http://fusesource.com
Twitter: davsclaus
Blog: http://davsclaus.blogspot.com/
Author of Camel in Action: http://www.manning.com/ibsen/
Re: RoutingSlip and Splitter
Posted by serega <se...@sybase.com>.
Claus Ibsen-2 wrote:
>
>
> If the split is the same then just add it as a separate route and link
> using direct endpoint
>
> from("direct:splitMe")
> .split(body().tokenize(","))
> .recipientList(header("route"));
>
> And then just send to "direct:spltMe" in your routing slip.
>
> Claus Ibsen
> -----------------
> FuseSource
> Email: cibsen@fusesource.com
> Web: http://fusesource.com
> Twitter: davsclaus
> Blog: http://davsclaus.blogspot.com/
> Author of Camel in Action: http://www.manning.com/ibsen/
>
Thanks Claus.
By the way I had a mistake in my example. I meant routingSlip() instead of
recipientList().
Sergey.
--
View this message in context: http://camel.465427.n5.nabble.com/RoutingSlip-and-Splitter-tp3337040p3337268.html
Sent from the Camel - Users mailing list archive at Nabble.com.
Re: RoutingSlip and Splitter
Posted by Claus Ibsen <cl...@gmail.com>.
On Tue, Jan 11, 2011 at 9:34 PM, serega <se...@sybase.com> wrote:
>
> I was able to achieve splitting before recipient list. Here is my test route
> ChoiceDefinition choice = from("direct:e").bean("RoutingSlip",
> "computeSlip").choice();
>
> choice.when(header("split").isNotNull()).split(body(String.class).tokenize(",")).recipientList(header("route"));
> choice.otherwise().recipientList(header("route"));
>
> The computeSlip() method will compute the routing slip and will set it as
> header "route", and may optionally set header "split".
> It works, but I would rather split the message as the last step in the
> sequence, and not as the first one.
>
If the split is the same then just add it as a separate route and link
using direct endpoint
from("direct:splitMe")
.split(body().tokenize(","))
.recipientList(header("route"));
And then just send to "direct:spltMe" in your routing slip.
> Sergey.
>
> --
> View this message in context: http://camel.465427.n5.nabble.com/RoutingSlip-and-Splitter-tp3337040p3337218.html
> Sent from the Camel - Users mailing list archive at Nabble.com.
>
--
Claus Ibsen
-----------------
FuseSource
Email: cibsen@fusesource.com
Web: http://fusesource.com
Twitter: davsclaus
Blog: http://davsclaus.blogspot.com/
Author of Camel in Action: http://www.manning.com/ibsen/
Re: RoutingSlip and Splitter
Posted by serega <se...@sybase.com>.
I was able to achieve splitting before recipient list. Here is my test route
ChoiceDefinition choice = from("direct:e").bean("RoutingSlip",
"computeSlip").choice();
choice.when(header("split").isNotNull()).split(body(String.class).tokenize(",")).recipientList(header("route"));
choice.otherwise().recipientList(header("route"));
The computeSlip() method will compute the routing slip and will set it as
header "route", and may optionally set header "split".
It works, but I would rather split the message as the last step in the
sequence, and not as the first one.
Sergey.
--
View this message in context: http://camel.465427.n5.nabble.com/RoutingSlip-and-Splitter-tp3337040p3337218.html
Sent from the Camel - Users mailing list archive at Nabble.com.