public String handleIncomingOrder(@JsonPath("$.order.customerId") int customerId, @JsonPath("$.order.item") String item, @Bean(ref = "guid", method = "generate") int orderId) { // convert the order to a CSV and inject the generated order id return String.format("%d,%d,%s", orderId, customerId, item); }
public Document handleIncomingOrder(@Body Document xml, @XPath("/order/@customerId") int customerId, @Bean(ref = "guid", method = "generate") int orderId) { Attr attr = xml.createAttribute("orderId"); attr.setValue("" + orderId); Node node = xml.getElementsByTagName("order").item(0); node.getAttributes().setNamedItem(attr); return xml; }
public Document handleIncomingOrder(@Body Document xml, @XPath(value = "/c:order/@customerId", namespaces = @NamespacePrefix( prefix = "c", uri = "http://camelinaction.com/order")) int customerId, @Bean(ref = "guid", method = "generate") int orderId) { Attr attr = xml.createAttribute("orderId"); attr.setValue("" + orderId); Node node = xml.getElementsByTagName("order").item(0); node.getAttributes().setNamedItem(attr); return xml; }
@Consume(uri = "direct:startBeanExpression") public void doSomethingBeanExpression(String payload, @Bean(ref = "myCounter") int count) { template.sendBodyAndHeader("mock:result", "Bye " + payload, "count", count); }