13.5. 示例
在以下路由中,我们插入 浏览
组件,以便可以浏览要经过的 Exchanges:
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 } }