if (browser instanceof ITraceExchangeBrowser) {
final Function1 function = new Function1() {
@Override
public Object apply(Object element) {
Exchange exchange = Exchanges.asExchange(element);
if (exchange != null) {
return exchange.getExchangeIndex();
}
return null;
}
};
column = addColumnFunction(bounds, column, function, "Trace ID");
}
// TODO add exchange / message ID??
if (browser instanceof ITraceExchangeBrowser) {
if (showTraceExchangeId) {
final Function1 function = new Function1() {
@Override
public Object apply(Object element) {
Exchange exchange = Exchanges.asExchange(element);
if (exchange != null) {
return exchange.getId();
}
return null;
}
};
column = addColumnFunction(bounds, column, function, "Exchange ID");
}
}
if (showBody) {
final Function1 function = new Function1() {
@Override
public Object apply(Object element) {
if (element instanceof IExchange) {
IExchange exchange = (IExchange) element;
String answer = MessageUIHelper.getBody(exchange);
if (answer != null) {
// lets replace newlines
return answer.replace('\n', ' ');
}
}
return null;
}
};
column = addColumnFunction(bounds, column, function, "Message Body");
}
SortedSet<String> headers = new TreeSet<String>();
for (IExchange exchange : exchanges) {
IMessage in = exchange.getIn();
if (in != null) {
headers.addAll(in.getHeaders().keySet());
}
}
for (final String header : headers) {
final Function1 function = new Function1() {
@Override
public Object apply(Object element) {
if (element instanceof IExchange) {
IExchange exchange = (IExchange) element;
IMessage in = exchange.getIn();
if (in != null) {
return in.getHeaders().get(header);
}
}
return null;