Cafe ExamplePage edited by willem jiangCafe ExampleThis example shows how to use Camel to implement a Cafe use case. First It uses the splitter to dispatch the order, then sends the orders to barista by checking if the coffee is hot or cold. When the coffee is ready, we use a aggregate to gather the drinks for waiter to deliver. Here is the route builder code for it. public void configure() { from("direct:cafe") .split().method("orderSplitter").to("direct:drink"); from("direct:drink").recipientList().method("drinkRouter"); from("seda:coldDrinks?concurrentConsumers=2").to("bean: ?method=prepareColdDrink").to("direct:deliveries"); from("seda:hotDrinks?concurrentConsumers=3").to("bean:barista?method=prepareHotDrink").to("direct:deliveries"); from("direct:deliveries") .aggregate(new CafeAggregationStrategy()).method("waiter", "checkOrder") .batchTimeout(5 * 1000L) .to("bean:waiter?method=prepareDelivery") .to("bean:waiter?method=deliverCafes"); }
Change Notification Preferences
View Online
|
View Change
|
Add Comment
|
- [CONF] Apache Camel > Cafe Example confluence
- [CONF] Apache Camel > Cafe Example confluence