@Consume(uri = "activemq:personnel.records") @RecipientList public String[] route(@XPath("/person/city/text()") String city) { if (city.equals("London")) { LOG.info("Person is from EMEA region"); return new String[] {"file:target/messages/emea/hr_pickup", "file:target/messages/emea/finance_pickup"}; } else { LOG.info("Person is from AMER region"); return new String[] {"file:target/messages/amer/hr_pickup", "file:target/messages/amer/finance_pickup"}; } }
@RecipientList public String handleError(Exchange exchange) { // store a property on the exchange with the number of total attempts int attempts = exchange.getProperty("attempts", 0, int.class); attempts++; exchange.setProperty("attempts", attempts); // we want to retry at most 4 times if (attempts <= 4) { return "seda:retry"; } else { // okay we give up its a poison message return "log:giveup"; } }
@Consume(uri = "activemq:queue:inbox?concurrentConsumers=10") @RecipientList public String listen(Exchange exchange) { topic.send(exchange); String type = exchange.getIn().getHeader("type", String.class); return "direct:" + type; }
@Consume(uri = "direct:foo", context = "camel-2") @RecipientList(context = "camel-2") public String[] doSomething(String body) { LOG.info("Received body: " + body); return new String[]{"mock:foo", "mock:result"}; }
@RecipientList public String[] route(@XPath("/order/@customer") String customer) { if (isGoldCustomer(customer)) { return new String[] {"jms:accounting", "jms:production"}; } else { return new String[] {"jms:accounting"}; } }
@RecipientList(strategyRef = "myStrategy", parallelProcessing = true, timeout = 1000) public String[] route(String body) { return new String[] {"direct:a", "direct:b", "direct:c"}; }
@RecipientList public String doSomething() { return "async:hi:camel,direct:foo"; }
@RecipientList public String doSomething() { return "async:bye:camel"; }
@RecipientList public String doSomething() { return "async:hi:camel,async:hi:world,direct:foo"; }
@RecipientList @Consume(uri = "direct:inbound") public List<String> route() { return Arrays.asList("mock:outbound1", "mock:outbound2"); }
@Consume(uri = "direct:start") @RecipientList public String[] route(String body) { return new String[]{"mock:a", "mock:b"}; }
@RecipientList public String[] route() { return new String[] { "direct:one", "direct:two" }; }