You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by an...@wayofquality.de on 2013/07/22 17:19:11 UTC
Custom names for processors within routes
Hello,
I apologize if the following is a stupid question.
I have a Custom Routebuilder building a route within a Camel Context.
The route itself works fine.
The code is relatively straight forward:
@Override
public void configure() throws Exception {
errorHandler(deadLetterChannel(getErrorUri()));
from(getEntryUri())
.process(getProcessor())
.process(new Processor() {
@Override
public void process(Exchange exchange) throws Exception {
exchange.setOut(exchange.getIn());
if (dispatcher == null) {
throw new Exception("No dispatcher configured. Have you set
the exit prefix ?");
}
dispatcher.dispatch(exchange);
}
});
}
I am using Java as I use an OSGI Managed Service to configure the
duspatcher at runtime and also to inject a pre processor as a first
step.
Also I found that injecting those into a Java route builder allowed me
to unit test the processors more elegantly.
Back to the point...In JVisualVm I can see my processors in the tree
beneath a folder named after my route identifier. Beneath this entry i
see two processors named processor1 and processor2.
Is there any way to influence those last 2 names from my route builder
? - Potentially I have overlooked something in the docs ...
For convenience I have attached a piece of my JVisualVM screenshot
that shows the processors in question.
Best regards
Andreas
Re: Custom names for processors within routes
Posted by Andreas Gies <an...@wayofquality.de>.
Works like a charm; as expected ;)
Thx
Andreas
Am 7/22/13(30) 5:22 PM schrieb "Claus Ibsen" unter <cl...@gmail.com>:
>Hi
>
>Yep set the id of the processors. Then that id is used as part of the JMX
>name
>http://camel.apache.org/camel-jmx.html
>
>.process( ... ).id("nameOfMyProcessor")
>
>On Mon, Jul 22, 2013 at 5:19 PM, <an...@wayofquality.de> wrote:
>>
>> Hello,
>>
>> I apologize if the following is a stupid question.
>>
>> I have a Custom Routebuilder building a route within a Camel Context.
>>The
>> route itself works fine.
>>
>> The code is relatively straight forward:
>>
>> @Override
>> public void configure() throws Exception {
>> errorHandler(deadLetterChannel(getErrorUri()));
>>
>> from(getEntryUri())
>> .process(getProcessor())
>> .process(new Processor() {
>> @Override
>> public void process(Exchange exchange) throws Exception {
>> exchange.setOut(exchange.getIn());
>>
>> if (dispatcher == null) {
>> throw new Exception("No dispatcher configured. Have you set
>>the
>> exit prefix ?");
>> }
>>
>> dispatcher.dispatch(exchange);
>> }
>> });
>> }
>>
>> I am using Java as I use an OSGI Managed Service to configure the
>>duspatcher
>> at runtime and also to inject a pre processor as a first step.
>> Also I found that injecting those into a Java route builder allowed me
>>to
>> unit test the processors more elegantly.
>>
>> Back to the point...In JVisualVm I can see my processors in the tree
>>beneath
>> a folder named after my route identifier. Beneath this entry i see two
>> processors named processor1 and processor2.
>>
>> Is there any way to influence those last 2 names from my route builder
>>? -
>> Potentially I have overlooked something in the docs ...
>>
>> For convenience I have attached a piece of my JVisualVM screenshot that
>> shows the processors in question.
>>
>> Best regards
>> Andreas
>>
>>
>>
>
>
>
>--
>Claus Ibsen
>-----------------
>Red Hat, Inc.
>Email: cibsen@redhat.com
>Twitter: davsclaus
>Blog: http://davsclaus.com
>Author of Camel in Action: http://www.manning.com/ibsen
Re: Custom names for processors within routes
Posted by Claus Ibsen <cl...@gmail.com>.
Hi
Yep set the id of the processors. Then that id is used as part of the JMX name
http://camel.apache.org/camel-jmx.html
.process( ... ).id("nameOfMyProcessor")
On Mon, Jul 22, 2013 at 5:19 PM, <an...@wayofquality.de> wrote:
>
> Hello,
>
> I apologize if the following is a stupid question.
>
> I have a Custom Routebuilder building a route within a Camel Context. The
> route itself works fine.
>
> The code is relatively straight forward:
>
> @Override
> public void configure() throws Exception {
> errorHandler(deadLetterChannel(getErrorUri()));
>
> from(getEntryUri())
> .process(getProcessor())
> .process(new Processor() {
> @Override
> public void process(Exchange exchange) throws Exception {
> exchange.setOut(exchange.getIn());
>
> if (dispatcher == null) {
> throw new Exception("No dispatcher configured. Have you set the
> exit prefix ?");
> }
>
> dispatcher.dispatch(exchange);
> }
> });
> }
>
> I am using Java as I use an OSGI Managed Service to configure the duspatcher
> at runtime and also to inject a pre processor as a first step.
> Also I found that injecting those into a Java route builder allowed me to
> unit test the processors more elegantly.
>
> Back to the point...In JVisualVm I can see my processors in the tree beneath
> a folder named after my route identifier. Beneath this entry i see two
> processors named processor1 and processor2.
>
> Is there any way to influence those last 2 names from my route builder ? -
> Potentially I have overlooked something in the docs ...
>
> For convenience I have attached a piece of my JVisualVM screenshot that
> shows the processors in question.
>
> Best regards
> Andreas
>
>
>
--
Claus Ibsen
-----------------
Red Hat, Inc.
Email: cibsen@redhat.com
Twitter: davsclaus
Blog: http://davsclaus.com
Author of Camel in Action: http://www.manning.com/ibsen