JMS Websphere MQ BytesMessge and TextMessage
Question
I have a Java application that sets a listener on a queue, the onMessage(Message)
gets a subclass of javax.jms.TextMessage
, how can i make it get a subclass of javax.jms.BytesMessage
Note: I don't have access to the application that sends the messages.
Solution
The message type is determined by the sender. If the sender can't change, the received message type can't change.
What's the ultimate goal? Can you change how the receiver processes the message to accomplish what you're trying to do? Having the String from a TextMessage, you could use String.getBytes() to get the byte array version of that String.
If you want to do anything much more exotic than that, wouldn't you need some cooperation from the sender anyway?
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow