camel-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From PJ Walstroem <walst...@hotmail.com>
Subject wireTap: how to put a map in newExchangeBody?
Date Thu, 15 Aug 2013 14:01:30 GMT
hello,
I have a map with two entries which I would like to use as the new body in a
wireTap

.wireTap("log:foo").newExchangeBody(myMap).end()

I managed doing this by writing a custom Expression, but there must be an
easier way of doing this?

.newExchangeBody(new Expression() {
@Override
public <T> T evaluate(Exchange exchange, Class<T> type) {
 Map<String, String> newBody = new HashMap<>(); 
  newBody.put("supplier",
(String)exchange.getIn().getHeader("supplierName"));
  newBody.put("status", "started");
 return exchange.getContext().getTypeConverter().convertTo(type, exchange,
newBody);
}})

any suggestions would be highly appreciated!

cheers,
pj



--
View this message in context: http://camel.465427.n5.nabble.com/wireTap-how-to-put-a-map-in-newExchangeBody-tp5737340.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Mime
View raw message