Camel
  1. Camel
  2. CAMEL-697

transform() doesnt propogate headers

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 1.4.0
    • Fix Version/s: 1.4.0
    • Component/s: camel-core
    • Labels:
      None

      Description

      The new transform() DSL doesn't propogate headers so you can not do:

                      from("direct:four")
                          .transform().constant("London")
                          .to("mock:result");
      

      And expect that any headers on the exchange at direct:four is received after the transform

        Activity

        Hide
        Claus Ibsen added a comment -

        The solution is to add this in the TransformProcessor

            public void process(Exchange exchange) throws Exception {
                Object newBody = expression.evaluate(exchange);
                exchange.getOut().setBody(newBody);
        
                // propogate headers
                exchange.getOut().getHeaders().putAll(exchange.getIn().getHeaders());
                
                super.process(exchange);
            }
        
        Show
        Claus Ibsen added a comment - The solution is to add this in the TransformProcessor public void process(Exchange exchange) throws Exception { Object newBody = expression.evaluate(exchange); exchange.getOut().setBody(newBody); // propogate headers exchange.getOut().getHeaders().putAll(exchange.getIn().getHeaders()); super .process(exchange); }

          People

          • Assignee:
            Claus Ibsen
            Reporter:
            Claus Ibsen
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development