camel-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Henryk Konsek <>
Subject Re: copy of Exchange during Multicast
Date Thu, 14 Jun 2012 11:26:52 GMT

> Is there a way to make changes done to the
> header visible in further processing?

Yes. Actually modifications to the headers of the exchanged copied by
multicast are available in the aggregator.

In the example below GroupedExchangeAggregationStrategy will aggregate
two exchanges copied by multicast. And each of the aggregated messages
will got another header set on it (HEADER1 and HEADER2 respectively).

CamelContext camelContext = new DefaultCamelContext();
camelContext.addRoutes(new RouteBuilder() {
  public void configure() throws Exception {
    from("direct:start").multicast(new GroupedExchangeAggregationStrategy()).
      to("direct:headerModifier1", "direct:headerModifier2").

    from("direct:headerModifier1").process(new Processor() {
      public void process(Exchange exchange) throws Exception {
        exchange.getIn().setHeader("KEY1", "VALUE1");

    from("direct:headerModifier2").process(new Processor() {
      public void process(Exchange exchange) throws Exception {
        exchange.getIn().setHeader("KEY2", "VALUE2");

camelContext.createProducerTemplate().sendBody("direct:start", "TestMe!");

Kind regards.

Henryk Konsek

View raw message