54.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 } }