Looking at that piece of code there are other things that make little sense.
You are attaching a message listener to the the consumer.
But then you are using consumer.receive ?
What about the code in the onMessage() method in your message Listener???
Like Jeff said your sending program needs to specify that it is sending a TextMessage. This is done in JMS/XMS by sending an actual TextMessage (class). Others (broker) can construct it by making sure that the RFH header contains the format MQFMT_STRING in the format field related to the next section of the message.
Have fun
You could also verify your XMS code by creating a message using RFHUtil and see how that goes. _________________ MQ & Broker admin
I would like to know the reason for having message listener and then call receive for the same consumer. I suggest you remove one of them, either have the message listener or receive call.
The second point. It appears that XMS is unable to recognize the type of the message your application is receiving and hence defaulting to XMS_MESSAGE_TYPE_BASE. This type of message will not have any body. So when attempting cast message with empty body to a TextMessage, I think the text message is getting created with a null body. So getText is having a problem.
It's always good to first determine the type of the message and then cast the message accordingly. Please look at SampleConsumerCpp for more detail.
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum