You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by damianharvey <da...@gmail.com> on 2010/11/16 06:08:45 UTC

RecipientList repeating parent body

I have a route that uses RecipientList to call "exec" (see
http://stackoverflow.com/questions/4103499/apache-camel-exec-with-args) :

from("seda:start")
.log("******* Started single body : ${body}")
.recipientList(simple("exec:GetClaimList${header.osCmdSuffix}?useStderrOnEmptyStdout=true&args=${body.client}"))
.log("******* Executed OS cmd and received: ${body}")
.to("seda:finish");

When this is called on its own then it works fine and I get the output of
the OS Command as the body: eg:

"Executed OS cmd and received:
<claim-list><claim><clm-no>0952305</clm-no></claim></claim-list>"

However I have a parent route that splits a list of Clients up and calls
this route once for each. When this happens the output of the ReceipientList
"exec" is the body of the parent route: eg:

"Executed OS cmd and received:
[com.aon.cbs.clientrequest.ClientRequestBean@18c3679,
com.aon.cbs.clientrequest.ClientRequestBean@4c47db,
com.aon.cbs.clientrequest.ClientRequestBean@18c74]"

The splitting is working ok as the first log statement is showing only 1
ClientRequestBean.

Can anyone tell me why this is occurring and what solution might work?

Thanks,

Damian.
-- 
View this message in context: http://camel.465427.n5.nabble.com/RecipientList-repeating-parent-body-tp3266855p3266855.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: RecipientList repeating parent body

Posted by damianharvey <da...@gmail.com>.
Hi Claus, Thanks for answering.

I have a route/flow that calls a specific OS command to retrieve some XML
(it's from a COBOL script). It is required to be called on it's own with a
single Client or with a list of Clients.

The main route (as per original post but with the response endpoint logic) : 

from("seda:start")
.log("******* Started single body : ${body}")
.recipientList(simple("exec:GetClaimList${header.osCmdSuffix}?useStderrOnEmptyStdout=true&args=${body.client}"))
.log("******* Executed OS cmd and received: ${body}")
.choice()
	.when(simple("${header.responseNode} == null"))
		.to("seda:finish")
	.otherwise()
		.recipientList(simple("${header.responseNode}"));

The "parent" route called with a list of Clients:

from("seda:multiStart")
.setHeader("responseNode", constant("seda:multiReply"))
.setHeader("UUID", BeanLanguage.bean(UUIDFactory.class, "generate"))
.split(body())
	.parallelProcessing()
	.to("seda:start");

And the route used to aggregate:

from("seda:multiReply")
.aggregate(header("UUID"), new ListAggregationStrategy())
.completionSize(header(Exchange.SPLIT_SIZE))
.to("seda:multiResponse");

Thanks,

Damian.

-- 
View this message in context: http://camel.465427.n5.nabble.com/RecipientList-repeating-parent-body-tp3266855p3268175.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: RecipientList repeating parent body

Posted by Claus Ibsen <cl...@gmail.com>.
On Tue, Nov 16, 2010 at 6:08 AM, damianharvey
<da...@gmail.com> wrote:
>
> I have a route that uses RecipientList to call "exec" (see
> http://stackoverflow.com/questions/4103499/apache-camel-exec-with-args) :
>
> from("seda:start")
> .log("******* Started single body : ${body}")
> .recipientList(simple("exec:GetClaimList${header.osCmdSuffix}?useStderrOnEmptyStdout=true&args=${body.client}"))
> .log("******* Executed OS cmd and received: ${body}")
> .to("seda:finish");
>
> When this is called on its own then it works fine and I get the output of
> the OS Command as the body: eg:
>
> "Executed OS cmd and received:
> <claim-list><claim><clm-no>0952305</clm-no></claim></claim-list>"
>
> However I have a parent route that splits a list of Clients up and calls
> this route once for each. When this happens the output of the ReceipientList
> "exec" is the body of the parent route: eg:
>
> "Executed OS cmd and received:
> [com.aon.cbs.clientrequest.ClientRequestBean@18c3679,
> com.aon.cbs.clientrequest.ClientRequestBean@4c47db,
> com.aon.cbs.clientrequest.ClientRequestBean@18c74]"
>
> The splitting is working ok as the first log statement is showing only 1
> ClientRequestBean.
>
> Can anyone tell me why this is occurring and what solution might work?
>

What do you mean by parent route?

Can you post the routes.


> Thanks,
>
> Damian.
> --
> View this message in context: http://camel.465427.n5.nabble.com/RecipientList-repeating-parent-body-tp3266855p3266855.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/