Hi,

this all looks good. The fact that you see text = null (even when it is
not null) in the log is because "text" filed of the text message object
is set only after the first call of getText() method.

What is returned by

objMessage. getText()

call?

Also, can you check that the message you've received is the same as the
one you are looking at in the web console (you can compare message ids)

To devs: should we override toString() method of the ActiveMQTextMessage
to call getText() in case text is null and then use introspection to
print itself? This way it is confusing, since newly consumed messages
seems to have no text in them.


Cheers

-- 
Dejan Bosanac


http://www.ttmsolutions.com - get a free ActiveMQ user guide

ActiveMQ in Action - http://www.manning.com/snyder/
Scripting in Java - http://www.scriptinginjava.net



Daniel Jabbour wrote:
> Hello,
>
> I am trying to consume messages off an ActiveMQ queue (ActiveMQ 5.x)
> sent by a ruby STOMP client.  The messages are being sent, and I can
> see them on the ActiveMQ web portal.  The message text contains a
> string, which I also see in the portal.
>
> However, when I receive the message in my Java/JMS consumer, I don't
> get the message text/string back, but instead I only see what look
> like message headers.  Headers and code are below. Anyone have any
> idea how I can get the text of the messages back?  Everything I've
> done is rather standard, so I have to imagine this is some kind of
> configuration issue. Thanks in advance.
>
> TextMessage contents in consumer (printed by "logger.debug(" Text
> Message : "+objMessage);"):
>
> Text Message : ActiveMQTextMessage {commandId = 4, responseRequired =
> false, messageId = ID:test.domain.net-42605-1223936784517-4:2:-1:1:2,
> originalDestination = null, originalTransactionId = null, producerId =
> ID:test.domain.net-42605-1223936784517-4:2:-1:1, destination =
> queue://com.infoex.test, transactionId = null, expiration = 0,
> timestamp = 1223944671503, arrival = 0, brokerInTime = 1223944671504,
> brokerOutTime = 1223945279514, correlationId = null, replyTo = null,
> persistent = true, type = null, priority = 0, groupID = null,
> groupSequence = 0, targetConsumerId = null, compressed = false, userID
> = null, content = [EMAIL PROTECTED],
> marshalledProperties = [EMAIL PROTECTED],
> dataStructure = null, redeliveryCounter = 0, size = 0, properties =
> null, readOnlyProperties = true, readOnlyBody = true, droppable =
> false, text = null}
>
> Snippet of JMS/Java code:
>
>    public void onMessage(Message message)
>     {
>         try
>         {
>             if (message instanceof TextMessage) {
>                 logger.debug(" TextMessage ");
>                 TextMessage objMessage = (TextMessage)message;
>                 logger.debug(" Text Message : "+objMessage);
>                 String jsonValue = (String) objMessage. getText();
>                 contentItems.fromStringEncoded(jsonValue);
>             }
>             else if (message instanceof ObjectMessage) {
>                 logger.debug(" Object Message ");
>                 ObjectMessage objMessage = (ObjectMessage)message;
>                 contentItems = (DataObject)objMessage.getObject();
>             }
>
> -- 
> Daniel Jabbour
> Executive Vice President of Systems Architecture
> Office: (646) 778-3789 x707
> [EMAIL PROTECTED]
> InfoExchange, Inc.
>
>


Reply via email to