Skip to content

Instantly share code, notes, and snippets.

@bogdanalbei
Last active July 23, 2016 20:09
Show Gist options
  • Select an option

  • Save bogdanalbei/b9dee18265c6d9092cec14a175f6ff15 to your computer and use it in GitHub Desktop.

Select an option

Save bogdanalbei/b9dee18265c6d9092cec14a175f6ff15 to your computer and use it in GitHub Desktop.
public class GroceriesRouteBuilder extends RouteBuilder {
public static final String VEGETABLES_QUEUE = "seda:vegetables";
public static final String FRUITS_QUEUE = "seda:fruits";
public static final String GROCERIES_QUEUE = "seda:groceries";
public static final String FRUIT_PROCESSOR = "fruitProcessor";
public static final String VEGETABLE_PROCESSOR = "vegetableProcessor";
public void configure() {
from(FRUITS_QUEUE)
.to(FRUIT_PROCESSOR);
from(VEGETABLES_QUEUE)
.to(VEGETABLE_PROCESSOR);
from(GROCERIES_QUEUE)
.choice()
//fruits go to the fruits queue
.when(body().isInstanceOf(Fruit.class))
.to(FRUITS_QUEUE)
//vegetables go to the vegetables queue
.when(body().isInstanceOf(Vegetable.class))
.to(VEGETABLES_QUEUE)
.endChoice();
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment