55.3. 示例
在以下路由中,我们插入一个 浏览:
组件以浏览要通过的交换:
from("activemq:order.in").to("browse:orderReceived").to("bean:processOrder");
现在,我们可以从 Java 代码中检查接收的交换:
private CamelContext context; public void inspectRecievedOrders() { 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 } }