title: Spring Integration DSL: Transformer using headers
body: <p>I want to use Java DSL for Spring Integration, but I can't figure out how to use message headers during transformation.</p>
  
  <p>My old implementation had a Transformer like this:</p>
  
  <pre><code>@Transformer(inputChannel = "inputChannel", outputChannel = "outputChannel")
  public EventB transform(
          EventA eventA,
          @Header("a_header") String aHeader,
          @Header("other_header") String otherHeader){
      return new EventB(eventA.getSomeField(), aHeader, otherHeader);
  }
  </code></pre>
  
  <p>Now I have the following DSL:</p>
  
  <pre><code>@Bean
  public IntegrationFlow aFlow(){
      return IntegrationFlows.from(EventASink.INPUT)
          .filter("headers['operation'] == 'OPERATION_A'")
          .transform() //&lt;-- What should I do here?
          .handle(Http.outboundGateway(uri).httpMethod(HttpMethod.POST))
          .get();
  }
  </code></pre>
  
  <p>I looked at the implementation of transform() method and I found that it can receive a GenericTransformer as parameter, but it seems to work only with message payload and I also need the headers.</p>
  
  <p>I also saw that some kind of reflection can be used, but I don't like it because its not refactor-safe.</p>
  
  <p>Any advice? Thanks in advance.</p>