You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by Murari Raghavan <mu...@gmail.com> on 2012/08/20 16:57:09 UTC

Passing arguments to a customer splitter

Hello:

Is there a way to pass arguments to a custom splitter? 

For eg - Route Builder calls a custom splitter -
DDSResponseSplitService.splitStatusResponse()

from(routesprops.getString(Constants.INBOUND))
    .split().method(DDSResponseSplitService.class, "splitStatusResponse")
    .process(new Processor() {
              public void process(Exchange exchange) throws Exception {
....

If the splitStatusResponse method accepts a property string xslfilepath, how
can I pass this argument in the call to the splitter method -
.split().method(DDSResponseSplitService.class, "splitStatusResponse")?
 
public List<String> splitStatusResponse(String ddsresponse, String
xslfilepath) throws Exception {

}

Thanks,
Murari




--
View this message in context: http://camel.465427.n5.nabble.com/Passing-arguments-to-a-customer-splitter-tp5717719.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: Passing arguments to a customer splitter

Posted by Christian Müller <ch...@gmail.com>.
You can set this as exchange property or message header befor you split the
message. Than you have access to this information in your custom splitter...

Best,
Christian

Sent from a mobile device
Am 20.08.2012 16:58 schrieb "Murari Raghavan" <mu...@gmail.com>:

> Hello:
>
> Is there a way to pass arguments to a custom splitter?
>
> For eg - Route Builder calls a custom splitter -
> DDSResponseSplitService.splitStatusResponse()
>
> from(routesprops.getString(Constants.INBOUND))
>     .split().method(DDSResponseSplitService.class, "splitStatusResponse")
>     .process(new Processor() {
>               public void process(Exchange exchange) throws Exception {
> ....
>
> If the splitStatusResponse method accepts a property string xslfilepath,
> how
> can I pass this argument in the call to the splitter method -
> .split().method(DDSResponseSplitService.class, "splitStatusResponse")?
>
> public List<String> splitStatusResponse(String ddsresponse, String
> xslfilepath) throws Exception {
>
> }
>
> Thanks,
> Murari
>
>
>
>
> --
> View this message in context:
> http://camel.465427.n5.nabble.com/Passing-arguments-to-a-customer-splitter-tp5717719.html
> Sent from the Camel - Users mailing list archive at Nabble.com.
>

Re: Passing arguments to a customer splitter

Posted by Claus Ibsen <cl...@gmail.com>.
Hi

You can read about bean parameter binding which is what is in use when
the method is being invoked.
http://camel.apache.org/bean-binding.html

However you may consider having getter/setters on
DDSResponseSplitService and then configure the xslt path on the bean
before its being used by Camel. And then you won't need that 2nd
parameter.

final DDSResponseSplitService service = new DDSResponseSplitService();
service.setXPathPath("myPath");

....

.split().method(service, "splitStatusResponse")



On Mon, Aug 20, 2012 at 4:57 PM, Murari Raghavan
<mu...@gmail.com> wrote:
> Hello:
>
> Is there a way to pass arguments to a custom splitter?
>
> For eg - Route Builder calls a custom splitter -
> DDSResponseSplitService.splitStatusResponse()
>
> from(routesprops.getString(Constants.INBOUND))
>     .split().method(DDSResponseSplitService.class, "splitStatusResponse")
>     .process(new Processor() {
>               public void process(Exchange exchange) throws Exception {
> ....
>
> If the splitStatusResponse method accepts a property string xslfilepath, how
> can I pass this argument in the call to the splitter method -
> .split().method(DDSResponseSplitService.class, "splitStatusResponse")?
>
> public List<String> splitStatusResponse(String ddsresponse, String
> xslfilepath) throws Exception {
>
> }
>
> Thanks,
> Murari
>
>
>
>
> --
> View this message in context: http://camel.465427.n5.nabble.com/Passing-arguments-to-a-customer-splitter-tp5717719.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, fusenews
Blog: http://davsclaus.com
Author of Camel in Action: http://www.manning.com/ibsen