activemq-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "James Strachan" <james.strac...@gmail.com>
Subject Re: Is it possible to modify messages in Interceptor?
Date Mon, 04 Sep 2006 06:54:24 GMT
Generally you can't easily change a message. Normally you consume the
message then send a new message. Its generally quite inefficient to
modify messages in place in the broker since it adds a massive
deserialization/serialization burden - but with some hacking it should
be possible.

On 8/30/06, dap <dennip_2000@yahoo.com> wrote:
>
> Hello,
>
> I modify messages(add new properties, change body etc.) in Interceptor.
> (current 4.1 snapshot)
>
> but the consumer gets the messages still unchanged.
>
> ***
>
> aqtivemq.xml:
>
>  <broker xmlns="http://activemq.org/config/1.0" useJmx="false">
>     ...
>     <plugins>
>           <org.apache.activemq.broker.util.ModifyBrokerPlugin/>
>    </plugins>
>     ...
>   </broker>
>
>
> ModifyBrokerPlugin.java:
>
> public class ModifyBrokerPlugin extends BrokerPluginSupport {
> …
>
>   public void send(ConnectionContext context, Message messageSend) throws
> Exception {
>
>          log.info("\n MapMessage before...: " + messageSend);
>
>                         MapMessage  msg  = (MapMessage)messageSend;
>
>                         msg.setStringProperty("foo","SUPER_FOO");
>
>                         //messageSend.getMessage().setProperty("foo2","SUPER_FOO2");
>
>          log.info("\n MapMessage after...: " + messageSend);            //message
> has been changed
>
>         super.send(context, messageSend);
>
>     }
> ...
> }
>
>
> ***
>
> Do I miss something here?
>
> Or could someone please provide an other idea / examle of modifying message
> in a Queue?
>
>
> thanks!
> --
> View this message in context: http://www.nabble.com/Is-it-possible-to-modify-messages-in-Interceptor--tf2189703.html#a6058250
> Sent from the ActiveMQ - User forum at Nabble.com.
>
>


-- 

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

Mime
View raw message