Skip to content
Advertisement

How to show full message text in org.apache.activemq.command.ActiveMQTextMessage

2022-12-14 14:04:56,317 DEBUG [org.apa.cam.com.jms.EndpointMessageListener] (Camel (camel-1) thread #8 – JmsConsumer[my.queue]) activemq://queue:my.queue consumer received JMS message: ActiveMQTextMessage {commandId = 13, responseRequired = true, messageId = ID:xxxx, originalDestination = null,…, content = org.apache.activemq.util.ByteSequence@11ba49fe, …, text = { “foo”: “bar”, “x…y”: false}}

Notice that text is truncated. How can I see the full text?

EndpointMessageListener has this log line:

JavaScript

And for message of type javax.jms.Message, the toString() method implementation of org.apache.activemq.command.ActiveMQTextMessage is:

JavaScript

where it always truncates to 60 chars.

JavaScript

Can I find out what the complete message was?

Advertisement

Answer

You could for instance test if the received JMSMessage is of type text, and if so, cast it and invoke the getText() method rather than the generic toString():

JavaScript

Beware it may also arrive as Bytes- or Stream-Message

User contributions licensed under: CC BY-SA
8 People found this is helpful
Advertisement