You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by Michael Rambichler <mi...@rambichler.at> on 2022/09/22 12:34:44 UTC

.process(MyProcessor.class)

Hi all,

just tried out to instantiate a CustomProcessor in a route (like it is
documented)
But this does not work.
Error: Cannot resolve method 'process(Class<MyProcessor>)'

Should we remove this from documentation?
USING A PROCESSOR IN A ROUTE

Once you have written a class which implements processor like this:

public class MyProcessor implements Processor {

    public void process(Exchange exchange) throws Exception {
        // do something...
    }

}

Then you can easily call this processor from a Java such as:

from("activemq:myQueue").process(MyProcessor.class);

Re: .process(MyProcessor.class)

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

Yeah you should create an instance

from("activemq:myQueue").process(new MyProcessor());



On Thu, Sep 22, 2022 at 2:35 PM Michael Rambichler <mi...@rambichler.at>
wrote:

> Hi all,
>
> just tried out to instantiate a CustomProcessor in a route (like it is
> documented)
> But this does not work.
> Error: Cannot resolve method 'process(Class<MyProcessor>)'
>
> Should we remove this from documentation?
> USING A PROCESSOR IN A ROUTE
>
> Once you have written a class which implements processor like this:
>
> public class MyProcessor implements Processor {
>
>     public void process(Exchange exchange) throws Exception {
>         // do something...
>     }
>
> }
>
> Then you can easily call this processor from a Java such as:
>
> from("activemq:myQueue").process(MyProcessor.class);
>


-- 
Claus Ibsen
-----------------
http://davsclaus.com @davsclaus
Camel in Action 2: https://www.manning.com/ibsen2