activemq-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From hackingbear <hackingb...@gmail.com>
Subject Re: How to set message property in broker filter
Date Sun, 17 Jan 2010 00:52:33 GMT

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.


Mime
View raw message