Anuj
Anuj

Reputation: 563

Convert ActiveMQBytesMessage to ActiveMQTextMessage in Java

How to get ActiveMQByteMessage body in text format ?

Boolean result = ((JmsMessage)message).getBody() instanceof ActiveMQBytesMessage; This result show it's true

For ActiveMQTestMessage I have to following : (ActiveMQTextMessage) ((JmsMessage)message).getBody().getText() which gives me required body content.

Upvotes: 0

Views: 3262

Answers (1)

Claus Ibsen
Claus Ibsen

Reputation: 55690

From the ActiveMQBytesMessage you can get the message content as bytes. And then you can convert that into a String.

That is just standard java with byte[] -> String

Upvotes: 2

Related Questions