camel-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Henryk Konsek <hekon...@gmail.com>
Subject Re: Invoke Camel route from bean
Date Wed, 19 Sep 2012 21:06:04 GMT
Hi,

> In some work flows service class expects response and some times it does not.

If response is requested, consider using asynchronous version of
ProducerTemplate methods returning java.util.Future instances. For
example ProducerTemplate#asyncRequestBody . This approach can
significantly improve performance of typical synchronous MVC
application.

> what is the best way to do that? Camel Proxies or Producer template or
> any other way out there?

It depends :) .

>   like
> from("myPojo:myMethod").to("direct:start");

You can't use Bean component [1] at the beginning of the route. If you
integrate client application with Camel infrastructure you would  like
to start your route with Direct endpoint...

// send message from client (webapp for example)
// to Camel infrastructure.
from("direct:startFromClient").to("seda:camelQueue")

Consider also using Guava Event Bus [2] for that purpose:

// In you MVC controller
@Autowired
EventBus webAppEventBus;
...
webAppEventBus.post(new EventFromMvcController());

// In Camel route
from("guava-eventbus:webAppEventBus").to("seda:camelQueue");

Kind regards.

[1] http://camel.apache.org/bean.html
[2] http://camel.apache.org/guava-eventbus.html

-- 
Henryk Konsek
http://henryk-konsek.blogspot.com

Mime
View raw message