Search in sources :

Example 1 with CafeAggregationStrategy

use of org.apache.camel.example.cafe.stuff.CafeAggregationStrategy in project camel by apache.

the class CafeRouteBuilder method createRegistry.

protected JndiRegistry createRegistry() throws Exception {
    JndiRegistry jndi = new JndiRegistry();
    jndi.bind("drinkRouter", new DrinkRouter());
    jndi.bind("orderSplitter", new OrderSplitter());
    jndi.bind("barista", new Barista());
    jndi.bind("waiter", new Waiter());
    jndi.bind("aggregatorStrategy", new CafeAggregationStrategy());
    return jndi;
}
Also used : JndiRegistry(org.apache.camel.impl.JndiRegistry) DrinkRouter(org.apache.camel.example.cafe.stuff.DrinkRouter) Barista(org.apache.camel.example.cafe.stuff.Barista) CafeAggregationStrategy(org.apache.camel.example.cafe.stuff.CafeAggregationStrategy) Waiter(org.apache.camel.example.cafe.stuff.Waiter) OrderSplitter(org.apache.camel.example.cafe.stuff.OrderSplitter)

Example 2 with CafeAggregationStrategy

use of org.apache.camel.example.cafe.stuff.CafeAggregationStrategy in project camel by apache.

the class CafeRouteBuilderTest method createRegistry.

@Override
protected JndiRegistry createRegistry() throws Exception {
    JndiRegistry jndi = super.createRegistry();
    jndi.bind("drinkRouter", driverRouter);
    jndi.bind("orderSplitter", new OrderSplitter());
    jndi.bind("barista", new Barista());
    jndi.bind("waiter", waiter);
    jndi.bind("aggregatorStrategy", new CafeAggregationStrategy());
    return jndi;
}
Also used : JndiRegistry(org.apache.camel.impl.JndiRegistry) Barista(org.apache.camel.example.cafe.stuff.Barista) CafeAggregationStrategy(org.apache.camel.example.cafe.stuff.CafeAggregationStrategy) OrderSplitter(org.apache.camel.example.cafe.stuff.OrderSplitter)

Example 3 with CafeAggregationStrategy

use of org.apache.camel.example.cafe.stuff.CafeAggregationStrategy in project camel by apache.

the class CafeRouteBuilder method configure.

//START SNIPPET: RouteConfig
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:barista?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").completionTimeout(5 * 1000L).to("bean:waiter?method=prepareDelivery").to("bean:waiter?method=deliverCafes");
}
Also used : CafeAggregationStrategy(org.apache.camel.example.cafe.stuff.CafeAggregationStrategy)

Aggregations

CafeAggregationStrategy (org.apache.camel.example.cafe.stuff.CafeAggregationStrategy)3 Barista (org.apache.camel.example.cafe.stuff.Barista)2 OrderSplitter (org.apache.camel.example.cafe.stuff.OrderSplitter)2 JndiRegistry (org.apache.camel.impl.JndiRegistry)2 DrinkRouter (org.apache.camel.example.cafe.stuff.DrinkRouter)1 Waiter (org.apache.camel.example.cafe.stuff.Waiter)1