14.5. 示例
在以下路由中,我们插入一个 browse:
组件,以便浏览要传递的交换:
from("activemq:order.in").to("browse:orderReceived").to("bean:processOrder");
现在,我们可以检查来自 Java 代码中的接收的交换:
private CamelContext context; public void inspectReceivedOrders() { BrowsableEndpoint browse = context.getEndpoint("browse:orderReceived", BrowsableEndpoint.class); List<Exchange> exchanges = browse.getExchanges(); // then we can inspect the list of received exchanges from Java for (Exchange exchange : exchanges) { String payload = exchange.getIn().getBody(); // do something with payload } }