You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by Bak Attila <ba...@gmail.com> on 2009/08/03 16:58:14 UTC

Cascading bean and splitter

Hi,

I am trying to cascade a bean and a splitter like (java DSL):

        from("file:src/data?noop=true").bean(new
IncomingMessageValidator()).
        	split().method("splitter", "splitBody").
                to("direct:test");

It complains that method to(String) is undefined for object. What am i doing
wrong?

Thanks,
attila
-- 
View this message in context: http://www.nabble.com/Cascading-bean-and-splitter-tp24792299p24792299.html
Sent from the Camel - Users mailing list archive at Nabble.com.


Re: Cascading bean and splitter

Posted by Claus Ibsen <cl...@gmail.com>.
On Mon, Aug 3, 2009 at 4:58 PM, Bak Attila<ba...@gmail.com> wrote:
>
> Hi,
>
> I am trying to cascade a bean and a splitter like (java DSL):
>
>        from("file:src/data?noop=true").bean(new
> IncomingMessageValidator()).
>                split().method("splitter", "splitBody").
>                to("direct:test");
>
> It complains that method to(String) is undefined for object. What am i doing
> wrong?

Its because you use split() to set the expression and then end up with
the java compiler loosing track in the fluent builder
as you end up with a method that is an expression. And then you want
to continue with a .to that is a route.

There is a limit you hit the java compiler.

You can use the parameter versions (= put stuff in a parameter to
split) then you can do what you want

        from("file:src/data?noop=true").bean(new
 IncomingMessageValidator()).
                split(method("splitter", "splitBody")).
                to("direct:test");

You may need to do an static import of the method, I cannot remember
if you got it already in the base classes for the route builders.


>
> Thanks,
> attila
> --
> View this message in context: http://www.nabble.com/Cascading-bean-and-splitter-tp24792299p24792299.html
> Sent from the Camel - Users mailing list archive at Nabble.com.
>
>



-- 
Claus Ibsen
Apache Camel Committer

Open Source Integration: http://fusesource.com
Blog: http://davsclaus.blogspot.com/
Twitter: http://twitter.com/davsclaus

Re: Cascading bean and splitter

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

Ah there is a bit of confusing as its called method in the expressions.
But its a bean when you use the builders.

        from("direct:in").split(bean("splitter", "splitBody")).
                to("direct:test");


On Mon, Aug 3, 2009 at 5:42 PM, Bak Attila<ba...@gmail.com> wrote:
>
> Thanks for the fast reply.
> Unfortunately i cannot find the "method...." you suggest... Can you help?
> Or would the following be equivalent to the previous?:
>
>        from("file:src/data?noop=true").bean(new
> IncomingMessageValidator()).to("direct:in");
>
>        from("direct:in").split().method("splitter", "splitBody").
>                to("direct:test");
>
> Thanks
> attila
>
>
> Bak Attila wrote:
>>
>> Hi,
>>
>> I am trying to cascade a bean and a splitter like (java DSL):
>>
>>         from("file:src/data?noop=true").bean(new
>> IncomingMessageValidator()).
>>               split().method("splitter", "splitBody").
>>                 to("direct:test");
>>
>> It complains that method to(String) is undefined for object. What am i
>> doing wrong?
>>
>> Thanks,
>> attila
>>
>
> --
> View this message in context: http://www.nabble.com/Cascading-bean-and-splitter-tp24792299p24793035.html
> Sent from the Camel - Users mailing list archive at Nabble.com.
>
>



-- 
Claus Ibsen
Apache Camel Committer

Open Source Integration: http://fusesource.com
Blog: http://davsclaus.blogspot.com/
Twitter: http://twitter.com/davsclaus

Re: Cascading bean and splitter

Posted by Bak Attila <ba...@gmail.com>.
Thanks for the fast reply.
Unfortunately i cannot find the "method...." you suggest... Can you help?
Or would the following be equivalent to the previous?:

        from("file:src/data?noop=true").bean(new
IncomingMessageValidator()).to("direct:in");
        
        from("direct:in").split().method("splitter", "splitBody").
                to("direct:test");

Thanks
attila


Bak Attila wrote:
> 
> Hi,
> 
> I am trying to cascade a bean and a splitter like (java DSL):
> 
>         from("file:src/data?noop=true").bean(new
> IncomingMessageValidator()).
>         	split().method("splitter", "splitBody").
>                 to("direct:test");
> 
> It complains that method to(String) is undefined for object. What am i
> doing wrong?
> 
> Thanks,
> attila
> 

-- 
View this message in context: http://www.nabble.com/Cascading-bean-and-splitter-tp24792299p24793035.html
Sent from the Camel - Users mailing list archive at Nabble.com.