title: Overloading MessageHistory object for auditing purpouses
body: <p>I need to audit every message that pass throught an spring-integration flow, very basic one. </p>
  
  <p>The application reads from an int-redis:queue-inbound-channel-adapter and writes in an int-http:outbound-gateway. </p>
  
  <p>The output gateway has a reply-channel in order to receive the response of the http method, is in this exact moment when I want to register de audit information, including the initial message and http response.</p>
  
  <p>If the http method fails, the message goes to errorHandler and I can obtain the history object with timestamps and payload, what's perfect for audit.</p>
  
  <p>But if the http method works (Code 200,201 ...), I get a message including the ResponseEntity object with the status code, but I've no the initial payload from redis.</p>
  
  <p>So, is there any way to corelate the two messages (before sending http outbound and after http response) in order to get the full info for auditing?</p>
  
  <p>Thanks in advance!</p>
  
  <p>Here the integration flow:</p>
  
  <pre><code>&lt;int:message-history/&gt;
  
  &lt;int:channel id="responseChannel"/&gt;
  
  &lt;int:channel id="responseError"/&gt;
  
  &lt;int:logging-channel-adapter channel="responseChannel" level="INFO" 
     expression="@messageHandlerSpel.handle( #this )" id="logger"/&gt;
  
  &lt;int:logging-channel-adapter channel="responseError"
      level="ERROR" expression="@errorHandlerSpel.handle( #this )"
      id="LogingERROR"/&gt;
  
  &lt;int-redis:queue-inbound-channel-adapter id="inputRedis" connection-factory="redisCF" 
     channel="redisInput" queue="redis-input" serializer="" error-channel="responseError"/&gt;
  
  &lt;int:channel id="redisInput" /&gt;
  
  &lt;int-http:outbound-gateway id="HttpOutbound" request-channel="redisInput" 
     url="http://{server}:{port}/{index}/{type}/{id}" 
     http-method="PUT" extract-request-payload="true" charset="UTF-8" 
     reply-channel="responseChannel" request-factory="requestFactory"/&gt;
  </code></pre>
  
  <p>And the handler class:</p>
  
  <pre><code>@Component
  public class MessageHandlerSpel {
      public String handle(Message&lt;byte[]&gt; message) {
          MessageHeaders msgH = message.getHeaders();
          MessageHistory msgHistory = 
              message.getHeaders().get(MessageHistory.HEADER_NAME, MessageHistory.class);
          ... // Do whatever
      return "";
  }
  </code></pre>