Reading Tibco messages

jkavx
jkavx used Ask the Experts™
on
I'm able to retrieve messages from a Tibco queue.  Using Eclipse and stepping through the code, I can examine a Message object and see a text field that has the contents I'm interested in.  But I'm unable to programmaticallly pick up the text field.

Does anyone know how to get the text field from a Message object?

Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
Awarded 2011
Awarded 2011

Commented:
Top Expert 2009

Commented:
You said you can examine the text field in Eclipse.

Is the field not accessible? (private, etc.)

Have you tried .ToString() on the object?
Awarded 2011
Awarded 2011
Commented:
Message is actually interface
javax.jms.Message

It has subinterface

javx.jms.TextMessage extends Message

That subinterface has a getText() methiod

Perhpas you can cast your object as TextMessage then
you should be able to getText() from it



Mick BarryJava Developer
Top Expert 2010
Commented:
A Message does not necessarily have text. There are many different type of messages that can be passed using JMS. You can use instanceof to check the type of the message passed


      if (message instanceof TextMessage) {
         TextMessage txt = (TextMessage) message;
         System.out.println("Message Received: "+txt.getText());
      }

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial