You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@activemq.apache.org by TiredAndEmotional <st...@yahoo.co.uk> on 2006/11/29 23:43:01 UTC

Disappearing Message Properties

Hi, 

I am running ActiveMQ4.1. I'm not sure what I should expect from user
defined message properties, but the behaviour I am seeing is perplexing. 

The basic problem is as follows. I set a user defined int property in a
message (say, CID) and ActiveMQ logs this when the message is sent, thus.

156 [main] DEBUG pache.activemq.ActiveMQSession  - Sending message:
ActiveMQTextMessage {commandId = 0, responseRequired = false, messageId =
ID:Media-Centre-4005-1164839267578-1:0:1:1:2, originalDestination = null,
originalTransactionId = null, producerId =
ID:Media-Centre-4005-1164839267578-1:0:1:1, destination = queue://QQ,
transactionId = null, expiration = 0, timestamp = 1164839268046, arrival =
0, correlationId = null, replyTo = null, persistent = false, type = null,
priority = 4, groupID = null, groupSequence = 0, targetConsumerId = null,
compressed = false, userID = null, content = null, marshalledProperties =
null, dataStructure = null, redeliveryCounter = 0, size = 0, properties =
{CID=2}, readOnlyProperties = true, readOnlyBody = true, droppable = false,
text = Message 2}

Note that in this log entry, there is a property called CID=2. 

If I run a message producer that alternates between messages with CID=1 and
CID=2, and then run a consumer with a selector "CID=2", it will only receive
half the messages sent as expected. However, if the consumer tries:

message.getIntProperty("CID");

an Exception is thrown. Indeed, ActiveMQ logging shows that the received
message has no properties:

203 [main] DEBUG tivemq.ActiveMQMessageConsumer  - Received message:
MessageDispatch {commandId = 0, responseRequired = false, consumerId =
ID:Media-Centre-4009-1164839612437-1:0:1:1, destination = queue://QQ,
message = ActiveMQTextMessage {commandId = 6, responseRequired = false,
messageId = ID:Media-Centre-4005-1164839267578-1:0:1:1:2,
originalDestination = null, originalTransactionId = null, producerId =
ID:Media-Centre-4005-1164839267578-1:0:1:1, destination = queue://QQ,
transactionId = null, expiration = 0, timestamp = 1164839268046, arrival =
0, correlationId = null, replyTo = null, persistent = false, type = null,
priority = 4, groupID = null, groupSequence = 0, targetConsumerId = null,
compressed = false, userID = null, content =
org.apache.activemq.util.ByteSequence@2cb49d, marshalledProperties =
org.apache.activemq.util.ByteSequence@105d88a, dataStructure = null,
redeliveryCounter = 0, size = 0, properties = null, readOnlyProperties =
true, readOnlyBody = true, droppable = false, text = null},
redeliveryCounter = 0}

Note that "properties=null" in the above logging and the text of the message
also now seems to be null, instead of "Message 2" though:	

String text = textMessage.getText();

returns the appropriate message "Message 2"

What am I not understanding? Why can't I retrieve the property that the
consumer's selector could see?

Many thanks for your time and consideration in advance,

Steve Siller
-- 
View this message in context: http://www.nabble.com/Disappearing-Message-Properties-tf2728313.html#a7609654
Sent from the ActiveMQ - User mailing list archive at Nabble.com.


Re: Disappearing Message Properties

Posted by TiredAndEmotional <st...@yahoo.co.uk>.

Wild.  Do you get an exception when you try to get the property?  And
btw.. notice that while properties may be null, marshalledProperties
is not null.  The properties are just in marshaled form when you try
to access them.

Hi Hiram,

Sorry, but the exception was due to my mistake and wasn't ActiveMQ. The
"missing" properties were in the Marshalled Properties. It was late and I
had a deadline and something wasn't working correctly that seemed to suggest
a missing property and I didn't realise that the properties weren't
unmarshalled at the other end.

Best,

S


-- 
View this message in context: http://www.nabble.com/Disappearing-Message-Properties-tf2728313.html#a7680198
Sent from the ActiveMQ - User mailing list archive at Nabble.com.


Re: Disappearing Message Properties

Posted by Hiram Chirino <hi...@hiramchirino.com>.
Wild.  Do you get an exception when you try to get the property?  And
btw.. notice that while properties may be null, marshalledProperties
is not null.  The properties are just in marshaled form when you try
to access them.

On 11/29/06, TiredAndEmotional <st...@yahoo.co.uk> wrote:
>
> Hi,
>
> I am running ActiveMQ4.1. I'm not sure what I should expect from user
> defined message properties, but the behaviour I am seeing is perplexing.
>
> The basic problem is as follows. I set a user defined int property in a
> message (say, CID) and ActiveMQ logs this when the message is sent, thus.
>
> 156 [main] DEBUG pache.activemq.ActiveMQSession  - Sending message:
> ActiveMQTextMessage {commandId = 0, responseRequired = false, messageId =
> ID:Media-Centre-4005-1164839267578-1:0:1:1:2, originalDestination = null,
> originalTransactionId = null, producerId =
> ID:Media-Centre-4005-1164839267578-1:0:1:1, destination = queue://QQ,
> transactionId = null, expiration = 0, timestamp = 1164839268046, arrival =
> 0, correlationId = null, replyTo = null, persistent = false, type = null,
> priority = 4, groupID = null, groupSequence = 0, targetConsumerId = null,
> compressed = false, userID = null, content = null, marshalledProperties =
> null, dataStructure = null, redeliveryCounter = 0, size = 0, properties =
> {CID=2}, readOnlyProperties = true, readOnlyBody = true, droppable = false,
> text = Message 2}
>
> Note that in this log entry, there is a property called CID=2.
>
> If I run a message producer that alternates between messages with CID=1 and
> CID=2, and then run a consumer with a selector "CID=2", it will only receive
> half the messages sent as expected. However, if the consumer tries:
>
> message.getIntProperty("CID");
>
> an Exception is thrown. Indeed, ActiveMQ logging shows that the received
> message has no properties:
>
> 203 [main] DEBUG tivemq.ActiveMQMessageConsumer  - Received message:
> MessageDispatch {commandId = 0, responseRequired = false, consumerId =
> ID:Media-Centre-4009-1164839612437-1:0:1:1, destination = queue://QQ,
> message = ActiveMQTextMessage {commandId = 6, responseRequired = false,
> messageId = ID:Media-Centre-4005-1164839267578-1:0:1:1:2,
> originalDestination = null, originalTransactionId = null, producerId =
> ID:Media-Centre-4005-1164839267578-1:0:1:1, destination = queue://QQ,
> transactionId = null, expiration = 0, timestamp = 1164839268046, arrival =
> 0, correlationId = null, replyTo = null, persistent = false, type = null,
> priority = 4, groupID = null, groupSequence = 0, targetConsumerId = null,
> compressed = false, userID = null, content =
> org.apache.activemq.util.ByteSequence@2cb49d, marshalledProperties =
> org.apache.activemq.util.ByteSequence@105d88a, dataStructure = null,
> redeliveryCounter = 0, size = 0, properties = null, readOnlyProperties =
> true, readOnlyBody = true, droppable = false, text = null},
> redeliveryCounter = 0}
>
> Note that "properties=null" in the above logging and the text of the message
> also now seems to be null, instead of "Message 2" though:
>
> String text = textMessage.getText();
>
> returns the appropriate message "Message 2"
>
> What am I not understanding? Why can't I retrieve the property that the
> consumer's selector could see?
>
> Many thanks for your time and consideration in advance,
>
> Steve Siller
> --
> View this message in context: http://www.nabble.com/Disappearing-Message-Properties-tf2728313.html#a7609654
> Sent from the ActiveMQ - User mailing list archive at Nabble.com.
>
>


-- 
Regards,
Hiram

Blog: http://hiramchirino.com

Re: Disappearing Message Properties

Posted by TiredAndEmotional <st...@yahoo.co.uk>.

Hi James,

Many thanks for your response. I was incorrect about the exception...bug in
my test code. Your comment about the marshalled properties answers my
remaining concern about what is visible in the received message log output.

Once again, many thanks,

Steve Siller


James.Strachan wrote:
> 
> Could you give us the stack trace of the exception?
> 
> Note that custom properties are unmarshalled on demand which is why
> they are not always visible in logging statements.
> 
> On 11/29/06, TiredAndEmotional <st...@yahoo.co.uk> wrote:
>>
>> Hi,
>>
>> I am running ActiveMQ4.1. I'm not sure what I should expect from user
>> defined message properties, but the behaviour I am seeing is perplexing.
>>
>> The basic problem is as follows. I set a user defined int property in a
>> message (say, CID) and ActiveMQ logs this when the message is sent, thus.
>>
>> 156 [main] DEBUG pache.activemq.ActiveMQSession  - Sending message:
>> ActiveMQTextMessage {commandId = 0, responseRequired = false, messageId =
>> ID:Media-Centre-4005-1164839267578-1:0:1:1:2, originalDestination = null,
>> originalTransactionId = null, producerId =
>> ID:Media-Centre-4005-1164839267578-1:0:1:1, destination = queue://QQ,
>> transactionId = null, expiration = 0, timestamp = 1164839268046, arrival
>> =
>> 0, correlationId = null, replyTo = null, persistent = false, type = null,
>> priority = 4, groupID = null, groupSequence = 0, targetConsumerId = null,
>> compressed = false, userID = null, content = null, marshalledProperties =
>> null, dataStructure = null, redeliveryCounter = 0, size = 0, properties =
>> {CID=2}, readOnlyProperties = true, readOnlyBody = true, droppable =
>> false,
>> text = Message 2}
>>
>> Note that in this log entry, there is a property called CID=2.
>>
>> If I run a message producer that alternates between messages with CID=1
>> and
>> CID=2, and then run a consumer with a selector "CID=2", it will only
>> receive
>> half the messages sent as expected. However, if the consumer tries:
>>
>> message.getIntProperty("CID");
>>
>> an Exception is thrown. Indeed, ActiveMQ logging shows that the received
>> message has no properties:
>>
>> 203 [main] DEBUG tivemq.ActiveMQMessageConsumer  - Received message:
>> MessageDispatch {commandId = 0, responseRequired = false, consumerId =
>> ID:Media-Centre-4009-1164839612437-1:0:1:1, destination = queue://QQ,
>> message = ActiveMQTextMessage {commandId = 6, responseRequired = false,
>> messageId = ID:Media-Centre-4005-1164839267578-1:0:1:1:2,
>> originalDestination = null, originalTransactionId = null, producerId =
>> ID:Media-Centre-4005-1164839267578-1:0:1:1, destination = queue://QQ,
>> transactionId = null, expiration = 0, timestamp = 1164839268046, arrival
>> =
>> 0, correlationId = null, replyTo = null, persistent = false, type = null,
>> priority = 4, groupID = null, groupSequence = 0, targetConsumerId = null,
>> compressed = false, userID = null, content =
>> org.apache.activemq.util.ByteSequence@2cb49d, marshalledProperties =
>> org.apache.activemq.util.ByteSequence@105d88a, dataStructure = null,
>> redeliveryCounter = 0, size = 0, properties = null, readOnlyProperties =
>> true, readOnlyBody = true, droppable = false, text = null},
>> redeliveryCounter = 0}
>>
>> Note that "properties=null" in the above logging and the text of the
>> message
>> also now seems to be null, instead of "Message 2" though:
>>
>> String text = textMessage.getText();
>>
>> returns the appropriate message "Message 2"
>>
>> What am I not understanding? Why can't I retrieve the property that the
>> consumer's selector could see?
>>
>> Many thanks for your time and consideration in advance,
>>
>> Steve Siller
>> --
>> View this message in context:
>> http://www.nabble.com/Disappearing-Message-Properties-tf2728313.html#a7609654
>> Sent from the ActiveMQ - User mailing list archive at Nabble.com.
>>
>>
> 
> 
> -- 
> 
> James
> -------
> http://radio.weblogs.com/0112098/
> 
> 

-- 
View this message in context: http://www.nabble.com/Disappearing-Message-Properties-tf2728313.html#a7615428
Sent from the ActiveMQ - User mailing list archive at Nabble.com.


Re: Disappearing Message Properties

Posted by James Strachan <ja...@gmail.com>.
Could you give us the stack trace of the exception?

Note that custom properties are unmarshalled on demand which is why
they are not always visible in logging statements.

On 11/29/06, TiredAndEmotional <st...@yahoo.co.uk> wrote:
>
> Hi,
>
> I am running ActiveMQ4.1. I'm not sure what I should expect from user
> defined message properties, but the behaviour I am seeing is perplexing.
>
> The basic problem is as follows. I set a user defined int property in a
> message (say, CID) and ActiveMQ logs this when the message is sent, thus.
>
> 156 [main] DEBUG pache.activemq.ActiveMQSession  - Sending message:
> ActiveMQTextMessage {commandId = 0, responseRequired = false, messageId =
> ID:Media-Centre-4005-1164839267578-1:0:1:1:2, originalDestination = null,
> originalTransactionId = null, producerId =
> ID:Media-Centre-4005-1164839267578-1:0:1:1, destination = queue://QQ,
> transactionId = null, expiration = 0, timestamp = 1164839268046, arrival =
> 0, correlationId = null, replyTo = null, persistent = false, type = null,
> priority = 4, groupID = null, groupSequence = 0, targetConsumerId = null,
> compressed = false, userID = null, content = null, marshalledProperties =
> null, dataStructure = null, redeliveryCounter = 0, size = 0, properties =
> {CID=2}, readOnlyProperties = true, readOnlyBody = true, droppable = false,
> text = Message 2}
>
> Note that in this log entry, there is a property called CID=2.
>
> If I run a message producer that alternates between messages with CID=1 and
> CID=2, and then run a consumer with a selector "CID=2", it will only receive
> half the messages sent as expected. However, if the consumer tries:
>
> message.getIntProperty("CID");
>
> an Exception is thrown. Indeed, ActiveMQ logging shows that the received
> message has no properties:
>
> 203 [main] DEBUG tivemq.ActiveMQMessageConsumer  - Received message:
> MessageDispatch {commandId = 0, responseRequired = false, consumerId =
> ID:Media-Centre-4009-1164839612437-1:0:1:1, destination = queue://QQ,
> message = ActiveMQTextMessage {commandId = 6, responseRequired = false,
> messageId = ID:Media-Centre-4005-1164839267578-1:0:1:1:2,
> originalDestination = null, originalTransactionId = null, producerId =
> ID:Media-Centre-4005-1164839267578-1:0:1:1, destination = queue://QQ,
> transactionId = null, expiration = 0, timestamp = 1164839268046, arrival =
> 0, correlationId = null, replyTo = null, persistent = false, type = null,
> priority = 4, groupID = null, groupSequence = 0, targetConsumerId = null,
> compressed = false, userID = null, content =
> org.apache.activemq.util.ByteSequence@2cb49d, marshalledProperties =
> org.apache.activemq.util.ByteSequence@105d88a, dataStructure = null,
> redeliveryCounter = 0, size = 0, properties = null, readOnlyProperties =
> true, readOnlyBody = true, droppable = false, text = null},
> redeliveryCounter = 0}
>
> Note that "properties=null" in the above logging and the text of the message
> also now seems to be null, instead of "Message 2" though:
>
> String text = textMessage.getText();
>
> returns the appropriate message "Message 2"
>
> What am I not understanding? Why can't I retrieve the property that the
> consumer's selector could see?
>
> Many thanks for your time and consideration in advance,
>
> Steve Siller
> --
> View this message in context: http://www.nabble.com/Disappearing-Message-Properties-tf2728313.html#a7609654
> Sent from the ActiveMQ - User mailing list archive at Nabble.com.
>
>


-- 

James
-------
http://radio.weblogs.com/0112098/