title: Spring Coud Sleuth causing ActiveMQ/JMS message headers to be lost
body: <p>Versions:</p>
  <ul>
  <li>SpringBoot: 2.3.12.RELEASE</li>
  <li>SpringCloud: Hoxton.SR12</li>
  <li>SpringCloud Starter Sleuth: 3.0.3</li>
  <li>Camel: 3.4.6</li>
  </ul>
  <p>I want to add Sleuth to a pre-exisitng project that now makes use of ActiveMQ, previosuly it was jusing JMS. When I do, values from the ActiceMQ message get blocked/removed and (one being &quot;filename&quot; which is the key value for S2 requests). Other JMS values still seem to come through OK.</p>
  <p>I need to understand why the non-JMS values are getting blocked/removed (I cannot find any information on what would be causing that to happen) to prevent the errors.</p>
  <p>I know I can disbale Sleuth for JMS with <code>spring.sleuth.messaging.jms.enabled=true</code> but moving forwards I'd like to be able to trace the ActiveMQ/JMS code, so that workaround isn't particularly attractive.</p>
  <p>As this is pre-exiting code, I'd also like to avoid having to re-write it if at all possible.</p>
  <p>Has anyone gotten SPring Cloud Sleuth to work with ActiveMQ/JMS and can maybe point out where things are going wrong?</p>
  <p><strong>Edit:</strong></p>
  <p>Based on the initial response from Marcin, we found that the following version compile &amp; execute, although significant problems do remain:</p>
  <ul>
  <li>SpringBoot: 2.4.8</li>
  <li>SpringCloud: 2020.0.3</li>
  <li>Camel: 3.7.5</li>
  </ul>
  <p><strong>Without Sleuth</strong></p>
  <p>ActiveMQ message details:
  <a href="https://i.stack.imgur.com/roo9M.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/roo9M.png" alt="Without Sleuth" /></a></p>
  <p>Log message (&quot;filename&quot;, &quot;CamelAwsS3Etag&quot; etc present):</p>
  <pre><code>2021-08-16 10:10:37.889  INFO [MyApp,,] 28775 --- [umer[taskQueue]] taskQueueConsumer: ***HEADERS IN***: {CamelAwsS3ETag=39d029a87fa4c6aaee5f1de643d9f3f6, Content-Type=application/json, filename=_bl001/group0/_bl001-group0-1629104686042.zip, JMSCorrelationID=null, JMSCorrelationIDAsBytes=null, JMSDeliveryMode=2, JMSDestination=queue://taskQueue, JMSExpiration=0, JMSMessageID=ID:server-44053-1629104652998-1:3:1:1:1, JMSPriority=4, JMSRedelivered=false, JMSReplyTo=null, JMSTimestamp=1629104686350, JMSType=null, JMSXGroupID=_bl001-group0, JMSXGroupSeq=0, JMSXUserID=null}
  </code></pre>
  <p><strong>With Sleuth</strong></p>
  <p>ActiveMQ message details:
  <a href="https://i.stack.imgur.com/WHHlE.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/WHHlE.png" alt="With Sleuth, &quot;b3&quot; value showing" /></a></p>
  <p>Log message (&quot;filename&quot;, &quot;CamelAwsS3Etag&quot; etc are missing):</p>
  <pre><code>2021-08-16 10:24:33.821  INFO [MyApp,,] 31553 --- [umer[taskQueue]] taskQueueConsumer: ***HEADERS IN***: {JMSCorrelationID=null, JMSCorrelationIDAsBytes=null, JMSDeliveryMode=2, JMSDestination=queue://taskQueue, JMSExpiration=0, JMSMessageID=ID:server-42561-1629105658959-1:3:1:1:1, JMSPriority=4, JMSRedelivered=false, JMSReplyTo=null, JMSTimestamp=1629105675306, JMSType=null, JMSXGroupID=_bl000-group1, JMSXGroupSeq=0, JMSXUserID=null}
  </code></pre>
  <p><strong>Sample Java code</strong></p>
  <pre><code>@Component
  public class MyAppCoreRouter extends RouteBuilder {
  
      /* Other code */
  
      @Override
      public void configure() {
          from(&quot;activemq:queue:taskQueue?concurrentConsumers=&quot; + taskNumberOfConcurrentConsumers)
                  .log(&quot;***HEADERS IN***: ${headers}&quot;)
                  .routeId(&quot;taskQueueConsumer&quot;)
                  .threads(taskNumberOfConcurrentConsumers)
                  .pollEnrich().simple(&quot;aws-s3://myapp-task?amazonS3Client=#amazonS3Client&amp;fileName=${header.filename}&amp;operation=getObject&quot;)
                  .choice()
                  .when(header(S3Constants.KEY).endsWith(&quot;.zip&quot;))
                  .to(&quot;file://&quot; + taskLocalUnCompressedEndpoint + &quot;?fileName=${header.CamelAwsS3ETag}/${header.CamelAwsS3Key}&quot;)
                  .process(exchange -&gt; {
                      String camelAwsS3ETag = exchange.getIn().getHeader(&quot;CamelAwsS3ETag&quot;, String.class);
                      String camelAwsS3Key = exchange.getIn().getHeader(&quot;CamelAwsS3Key&quot;, String.class);
                      File uniqueDir = new File(taskLocalUnCompressedEndpoint, camelAwsS3ETag);
                      File taskZip = new File(uniqueDir, camelAwsS3Key);
                      new ZipFile(taskZip).extractAll(uniqueDir.getAbsolutePath());
                  })
                  .setHeader(&quot;resourceDirectory&quot;, simple(taskLocalUnCompressedEndpoint + &quot;/${header.CamelAwsS3ETag}&quot;)).setHeader(&quot;schedule.time&quot;, simple(&quot;${date:now}&quot;))
                  .removeHeader(&quot;CamelAwsS3Headers&quot;)
                  .log(LoggingLevel.DEBUG, &quot;Processing batch job ${headers}&quot;)
                  .to(&quot;spring-batch:importMyAppRecordJob&quot;)
                  .endChoice()
                  .otherwise()
                  .log(LoggingLevel.WARN, &quot;Unexpected file type, filtering file name ${header.CamelAwsS3Key} &quot;)
                  .end();
  
          /* Other code */
      }
  }
  </code></pre>