# How can I get the mq message body ,for example:Activemq、kafka？

**URL:** <https://discuss.elastic.co/t/how-can-i-get-the-mq-message-body-for-example-activemq-kafka/222632>\
**Category:** APM\
**Tags:** java\
**Created:** [March 9, 2020, 2:24am UTC](https://discuss.elastic.co/t/how-can-i-get-the-mq-message-body-for-example-activemq-kafka/222632 "2020-03-09T02:24:56Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![zhipengLin](https://avatars.discourse-cdn.com/v4/letter/z/7ea924/32.png) [@zhipengLin](https://discuss.elastic.co/u/zhipengLin)\
**Post date:** [March 9, 2020, 2:24am UTC](https://discuss.elastic.co/t/how-can-i-get-the-mq-message-body-for-example-activemq-kafka/222632/1 "2020-03-09T02:24:56Z")

</div>

If you are asking about a problem you are experiencing, please use the following template, as it will help us help you. If you have a different problem, please delete all of this text 🙂

**Kibana version** :  
7.6  
**Elasticsearch version** :  
7.6  
**APM Server version** :  
7.6  
**APM Agent language and version** :  
JAVA 1.13.0

==================  
I see the trace information in the span details of jms and kafka.  
but I can not see any message body? I just can see the queue name and the message head of ActiveMq and the queue name. what should I do if I want to see the message body

---

<div class="post-metadata">

**Author:** ![zhipengLin](https://avatars.discourse-cdn.com/v4/letter/z/7ea924/32.png) [@zhipengLin](https://discuss.elastic.co/u/zhipengLin)\
**Post date:** [March 9, 2020, 2:28am UTC](https://discuss.elastic.co/t/how-can-i-get-the-mq-message-body-for-example-activemq-kafka/222632/2 "2020-03-09T02:28:14Z")

</div>

this is my picture

 ![kafka](https://us1.discourse-cdn.com/elastic/original/3X/4/8/48878eb5d7a2b59c2c8249ba8f3caa4a55c2d934.png)  
 ![jms](https://us1.discourse-cdn.com/elastic/original/3X/9/9/994e42a347ab038b2511895e843fd7ae6f990d32.png)

the first picture is the kafka,the second picture is the activeMq

---

<div class="post-metadata">

**Author:** ![Eyal\_Koren](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/eyal_koren/32/36830_2.png) [@Eyal\_Koren](https://discuss.elastic.co/u/Eyal_Koren)\
**Post date:** [March 9, 2020, 7:40am UTC](https://discuss.elastic.co/t/how-can-i-get-the-mq-message-body-for-example-activemq-kafka/222632/3 "2020-03-09T07:40:57Z")

</div>

Hi and thanks for the question.  
Firstly, you need to [enable body capturing](https://www.elastic.co/guide/en/apm/agent/java/current/config-core.html#config-capture-body). Then, the agent would only capture bodies of `javax.jms.TextMessage` and the `toString` representation of Kafka records' keys and values.  
I hope this helps.

---

<div class="post-metadata">

**Author:** ![zhipengLin](https://avatars.discourse-cdn.com/v4/letter/z/7ea924/32.png) [@zhipengLin](https://discuss.elastic.co/u/zhipengLin)\
**Post date:** [March 9, 2020, 8:29am UTC](https://discuss.elastic.co/t/how-can-i-get-the-mq-message-body-for-example-activemq-kafka/222632/4 "2020-03-09T08:29:46Z")

</div>

thank you ,I get it

---

<div class="post-metadata">

**Author:** ![zhipengLin](https://avatars.discourse-cdn.com/v4/letter/z/7ea924/32.png) [@zhipengLin](https://discuss.elastic.co/u/zhipengLin)\
**Post date:** [March 9, 2020, 12:35pm UTC](https://discuss.elastic.co/t/how-can-i-get-the-mq-message-body-for-example-activemq-kafka/222632/5 "2020-03-09T12:35:55Z")

</div>

what shold i do if I want to caputure the Object type messages? use the public api?

---

<div class="post-metadata">

**Author:** ![zhipengLin](https://avatars.discourse-cdn.com/v4/letter/z/7ea924/32.png) [@zhipengLin](https://discuss.elastic.co/u/zhipengLin)\
**Post date:** [March 9, 2020, 12:45pm UTC](https://discuss.elastic.co/t/how-can-i-get-the-mq-message-body-for-example-activemq-kafka/222632/6 "2020-03-09T12:45:08Z")

</div>

our jms message type is javax.jms.ObjectMessage

---

<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:** [March 9, 2020, 2:29pm UTC](https://discuss.elastic.co/t/how-can-i-get-the-mq-message-body-for-example-activemq-kafka/222632/7 "2020-03-09T14:29:40Z")

</div>

How would you like the `ObjectMessage` to be rendered? Would calling the `toString` method be good enough?

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [March 30, 2020, 10:29am UTC](https://discuss.elastic.co/t/how-can-i-get-the-mq-message-body-for-example-activemq-kafka/222632/8 "2020-03-30T10:29:42Z")

</div>

This topic was automatically closed 20 days after the last reply. New replies are no longer allowed.
