简体   繁体   中英

Apache Camel - route starting layer

Suppose I've got an application based on Spring MVC with the following layers: - front end (jsp) - controller - manager - service - data access

I've got the following problem: some of the views require data from different sources (web services and internal DB) and after sourcing need to be aggregated. I'd like to make it in Camel, but the question is - which layer should 'fire' the route. In other words - I'd like to know the flow: first the front end takes us to one of the controller methods. But is it the place to start the camel route from?

I think there is a confusion between starting a Route and starting an Exchange .

The route will be started as soon as CamelContext will be started by the corresponding ApplicationContext . The Exchange on the particular route can be started using Injected ProducerTemplate eg: http://camel.apache.org/pojo-producing.html

The best place to aggregate the content from the different sources is a Camel Route itself.

I would create a Service Facade and initiate Camel Exchange, using ProducerTemplate, from there, as suggested here: https://camel.apache.org/hiding-middleware.html

All the Data Sources should be accessed in the Camel route, subsequently, Camel Route will apply the corresponding Enterprise Integration Pattern to enrich/aggregate/transform the content.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM