# Java APM Client: transfer transaction information when using BlockingQueue instead of ExecutorService

**URL:** <https://discuss.elastic.co/t/java-apm-client-transfer-transaction-information-when-using-blockingqueue-instead-of-executorservice/191781>\
**Category:** APM\
**Tags:** java\
**Created:** [July 23, 2019, 9:58am UTC](https://discuss.elastic.co/t/java-apm-client-transfer-transaction-information-when-using-blockingqueue-instead-of-executorservice/191781 "2019-07-23T09:58:31Z")\
**Posts on this page:** 1\
**Showing post:** 10

<div class="post-metadata">

**Author:** ![felixbarny](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/felixbarny/32/27341_2.png) [@felixbarny](https://discuss.elastic.co/u/felixbarny)\
**Post date:** [August 2, 2019, 12:39pm UTC](https://discuss.elastic.co/t/java-apm-client-transfer-transaction-information-when-using-blockingqueue-instead-of-executorservice/191781/10 "2019-08-02T12:39:36Z")

</div>

You can create a child span in the `onMessage` method and hand that over to the disruptor. In the EventHandler, you can set the start timestamp and the name of that span and activate it. See also [https://github.com/elastic/apm-agent-java/blob/master/apm-agent-plugins/apm-api-plugin/src/test/java/co/elastic/apm/api/BlockingQueueContextPropagationTest.java](https://github.com/elastic/apm-agent-java/blob/master/apm-agent-plugins/apm-api-plugin/src/test/java/co/elastic/apm/api/BlockingQueueContextPropagationTest.java)

If you really wanted to have two distinct transactions, you can also transfer the context to a map (`span.injectTraceHeaders((name, value) -> map.put(name, value))`) which you can hand over to the disruptor. In the EventHandler, you can then do `ElasticApm.startTransactionWithRemoteParent(key -> map.getHeader(key))`.

In [your other thread](https://discuss.elastic.co/t/detach-java-agent-runtime/191870/2), I'd also be interested to hear why having the agent threads around when `active=false` is a problem for your use case.

---

_[View the full topic](https://discuss.elastic.co/t/java-apm-client-transfer-transaction-information-when-using-blockingqueue-instead-of-executorservice/191781)._
