.wireTap("log:foo").newExchangeBody(constant(myMap)).end() On Thu, Aug 15, 2013 at 4:01 PM, PJ Walstroem <walst...@hotmail.com> wrote: > 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.
-- Claus Ibsen ----------------- Red Hat, Inc. Email: cib...@redhat.com Twitter: davsclaus Blog: http://davsclaus.com Author of Camel in Action: http://www.manning.com/ibsen