Uploaded image for project: 'Mule'
  1. Mule
  2. MULE-8522

Correlation Id is lost after http:request


    • Type: Bug
    • Status: Closed
    • Priority: To be reviewed
    • Resolution: Won't Fix or Usage Issue
    • Affects Version/s: 3.6.1
    • Fix Version/s: None
    • Labels:


      We use correlation Ids in our flows to help with digging into errors, by logging them and returning them to clients.

      After using an http:outbound-endpoint the CorrelationId was preserved in the flow, however with the http:request the CorrelationId seems to be lost from the message.

      Is this desired behaviour? If so, it means that I should be wrapping {{http:request}}s with an enricher to prevent losing the CID. But this really seems unnecessary. I doubt that this is the desired behaviour, so I'm raising the question.

      Here's an example flow that shows how the Cid is persisted across the first http:outbound-endpoint but is lost after the http:request

          <http:request-config name="HTTP_Request_Configuration" protocol="HTTP" doc:name="HTTP Request Configuration"/>
          <http:listener-config name="HTTP_Listener_Configuration" host="" port="8098" basePath="test" doc:name="HTTP Listener Configuration"/>
      	<flow name="testpostFlow1" >
      	    <http:inbound-endpoint exchange-pattern="request-response" host="localhost" port="8099" path="testpost" doc:name="HTTP"/>
              <logger level="INFO" doc:name="Logger" message="setting correlation Id"/>	    
              <scripting:component doc:name="Groovy">
                  <scripting:script engine="Groovy"><![CDATA[message.correlationId=message.id]]></scripting:script>
              <logger level="INFO" doc:name="Logger" message="Before http:outbound: #[message:correlationId] / #[message.outboundProperties['MULE_CORRELATION_ID']]"/>
      	    <http:outbound-endpoint exchange-pattern="request-response" method="POST" address="http://localhost:8098/test" mimeType="application/x-www-form-urlencoded" doc:name="HTTP"/>
              <logger level="INFO" doc:name="Logger" message="After http:outbound: #[message:correlationId] / #[message.outboundProperties['MULE_CORRELATION_ID']]"/> 
              <http:request  path="/test" method="POST" doc:name="HTTP" port="8098" host="localhost" config-ref="HTTP_Request_Configuration">
              <logger level="INFO" doc:name="Logger" message="After http:request: #[message:correlationId] / #[message.outboundProperties['MULE_CORRELATION_ID']]"/>
          <flow name="testcidlossFlow">
              <http:listener config-ref="HTTP_Listener_Configuration" path="/" doc:name="HTTP"/>
              <logger level="INFO" doc:name="Logger" message="    Inside other service/flow: #[message:correlationId] / #[message.outboundProperties['MULE_CORRELATION_ID']]"/>
              <set-payload doc:name="Set Payload" value="Some response"/>


      2015-04-21 10:41:39,820 INFO : setting correlation Id
      2015-04-21 10:41:40,112 INFO : Before http:outbound: 8e30aba0-e7c7-11e4-b0f8-7831c1d35dfa / 8e30aba0-e7c7-11e4-b0f8-7831c1d35dfa
      2015-04-21 10:41:40,351 INFO :     Inside other service/flow: null / null
      2015-04-21 10:41:40,399 INFO : After http:outbound: 8e30aba0-e7c7-11e4-b0f8-7831c1d35dfa / 8e30aba0-e7c7-11e4-b0f8-7831c1d35dfa
      2015-04-21 10:41:40,448 INFO :     Inside other service/flow: 8e30aba0-e7c7-11e4-b0f8-7831c1d35dfa / null
      2015-04-21 10:41:40,464 INFO : After http:request: null / null




            • Assignee:
              rewolf Andrew Flower
            • Votes:
              1 Vote for this issue
              4 Start watching this issue


              • Created: