아래 경로에서 찾아보기를 삽입하여 전달되는 교환을 검색할 수 있도록 구성 요소를 삽입합니다.In the route below, we insert a browse: component to be able to browse the Exchanges that are passed through:
Copy to ClipboardCopied!Toggle word wrapToggle overflow
이제 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
}
}
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
}
}
Copy to ClipboardCopied!Toggle word wrapToggle overflow