camel-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jan Matèrne (jhm) <apa...@materne.de>
Subject AW: How to called the processor
Date Thu, 22 Aug 2013 18:18:57 GMT
 
> 
> *can i able to do as below, if not then how can i acheive it ?*
> 
> from("direct:start").process(new Processor() {
> 
> 					@Override
> 					public void process(Exchange
exchange)
> throws Exception {
> 					System.out.println("control in
> processor");
> 
> 					}
> 				});


Sure, you could.
In your first example you create a route, wait 10s for incoming messages and
then exit.
And if a message would come, you could see your console output.

But you havent send a message to your "direct:start" endpoint.
So your little Camel application had not trigger to react on.

That's why your blog uses "timer://timer1?period=1000", which means "every
1s".
Another way would sending a message using a ProducerTemplate (see
http://camel.apache.org/walk-through-an-example.html).

ProducerTemplate template = context.createProducerTemplate();
template.sendBody("direct:start", "Test Message");


Jan


Mime
View raw message