You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@activemq.apache.org by hackingbear <ha...@gmail.com> on 2010/01/17 01:52:33 UTC
Re: How to set message property in broker filter
OK, got back to this.
I tried and it still does not work. Here is how the codes for timestamping
the message at the filter looks like
public void send(ProducerBrokerExchange producerExchange, Message msg)
throws Exception {
ActiveMQMessage amqmsg = (ActiveMQMessage)msg;
Object msgObj = msg.getMessage();
if (msgObj instanceof javax.jms.Message) {
javax.jms.Message jmsMsg = (javax.jms.Message) msgObj;
if (jmsMsg.getObjectProperty("timestamp") == null) {
jmsMsg.setLongProperty("timestamp",
System.currentTimeMillis());
}
}
At the consumer, this value does not exist for the received message.
Notice that the "msg" argument is always of class ActiveMQMessage which is a
subclass of command.Message and implements javax.jms.Message. And
msg.getMessage() simply returns itself as seen in the debugger.
So I still have no way to set the property at the broker level. Any other
idea?
Thanks
rajdavies wrote:
>
> f you are setting a jms property - make sure messageSend.getMessage()
> returns a javax.jms.Message and set the property there. It should work
> On 16 Nov 2009, at 19:02, hackingbear wrote:
>
--
View this message in context: http://old.nabble.com/How-to-set-message-property-in-broker-filter-tp26362561p27195295.html
Sent from the ActiveMQ - User mailing list archive at Nabble.com.
Re: How to set message property in broker filter
Posted by hackingbear <ha...@gmail.com>.
Posting the online URL of itself should help:
http://old.nabble.com/How-to-set-message-property-in-broker-filter-to26362561.html
Thanks a lot!!
rajdavies wrote:
>
> sry hackingbear - I can't remember the original context of this
> conversation - a little help pls! :)
>
> cheers,
>
> Rob
> On 17 Jan 2010, at 00:52, hackingbear wrote:
>
>>
>> OK, got back to this.
>>
>> I tried and it still does not work. Here is how the codes for
>> timestamping
>> the message at the filter looks like
>>
>> public void send(ProducerBrokerExchange producerExchange, Message
>> msg)
>> throws Exception {
>> ActiveMQMessage amqmsg = (ActiveMQMessage)msg;
>> Object msgObj = msg.getMessage();
>> if (msgObj instanceof javax.jms.Message) {
>> javax.jms.Message jmsMsg = (javax.jms.Message) msgObj;
>> if (jmsMsg.getObjectProperty("timestamp") == null) {
>> jmsMsg.setLongProperty("timestamp",
>> System.currentTimeMillis());
>> }
>> }
>>
>> At the consumer, this value does not exist for the received message.
>>
>> Notice that the "msg" argument is always of class ActiveMQMessage
>> which is a
>> subclass of command.Message and implements javax.jms.Message. And
>> msg.getMessage() simply returns itself as seen in the debugger.
>>
>> So I still have no way to set the property at the broker level. Any
>> other
>> idea?
>>
>> Thanks
>>
>>
>> rajdavies wrote:
>>>
>>> f you are setting a jms property - make sure
>>> messageSend.getMessage()
>>> returns a javax.jms.Message and set the property there. It should
>>> work
>>> On 16 Nov 2009, at 19:02, hackingbear wrote:
>>>
>>
>> --
>> View this message in context:
>> http://old.nabble.com/How-to-set-message-property-in-broker-filter-tp26362561p27195295.html
>> Sent from the ActiveMQ - User mailing list archive at Nabble.com.
>>
>
> Rob Davies
> http://twitter.com/rajdavies
> I work here: http://fusesource.com
> My Blog: http://rajdavies.blogspot.com/
> I'm writing this: http://www.manning.com/snyder/
>
>
>
>
>
>
>
--
View this message in context: http://old.nabble.com/How-to-set-message-property-in-broker-filter-tp26362561p27195423.html
Sent from the ActiveMQ - User mailing list archive at Nabble.com.
Re: How to set message property in broker filter
Posted by Rob Davies <ra...@gmail.com>.
sry hackingbear - I can't remember the original context of this
conversation - a little help pls! :)
cheers,
Rob
On 17 Jan 2010, at 00:52, hackingbear wrote:
>
> OK, got back to this.
>
> I tried and it still does not work. Here is how the codes for
> timestamping
> the message at the filter looks like
>
> public void send(ProducerBrokerExchange producerExchange, Message
> msg)
> throws Exception {
> ActiveMQMessage amqmsg = (ActiveMQMessage)msg;
> Object msgObj = msg.getMessage();
> if (msgObj instanceof javax.jms.Message) {
> javax.jms.Message jmsMsg = (javax.jms.Message) msgObj;
> if (jmsMsg.getObjectProperty("timestamp") == null) {
> jmsMsg.setLongProperty("timestamp",
> System.currentTimeMillis());
> }
> }
>
> At the consumer, this value does not exist for the received message.
>
> Notice that the "msg" argument is always of class ActiveMQMessage
> which is a
> subclass of command.Message and implements javax.jms.Message. And
> msg.getMessage() simply returns itself as seen in the debugger.
>
> So I still have no way to set the property at the broker level. Any
> other
> idea?
>
> Thanks
>
>
> rajdavies wrote:
>>
>> f you are setting a jms property - make sure
>> messageSend.getMessage()
>> returns a javax.jms.Message and set the property there. It should
>> work
>> On 16 Nov 2009, at 19:02, hackingbear wrote:
>>
>
> --
> View this message in context: http://old.nabble.com/How-to-set-message-property-in-broker-filter-tp26362561p27195295.html
> Sent from the ActiveMQ - User mailing list archive at Nabble.com.
>
Rob Davies
http://twitter.com/rajdavies
I work here: http://fusesource.com
My Blog: http://rajdavies.blogspot.com/
I'm writing this: http://www.manning.com/snyder/