You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@activemq.apache.org by T Akhayo <t....@gmail.com> on 2013/03/20 16:47:52 UTC

Order in which message is handled by broker plugins?

Good afternoon,

I have a activemq server for my jms messages, i've created a custom
authentication plugin and installed it:
BrokerService broker = new BrokerService();
MyAuthenticationPlugin map=new MyAuthenticationPlugin();
broker.setPlugins(new BrokerPlugin[]{  map});

Works nicely. Now i want to add a plugin that intercepts messages in the
send() method of BrokerFilter, this plugin will monitor all messages on all
topics and write a specific message to a database.

No problem, just add another plugin:
BrokerService broker = new BrokerService();
MyAuthenticationPlugin map=new MyAuthenticationPlugin();
OrderWatcherPlugin owp=new OrderWatcherPlugin();
broker.setPlugins(new BrokerPlugin[]{ owp, map});

Works nicely again. First the MyAuthenticationPlugin handles the message
next the OrderWatcherPlugin handles the message. When i throw a
SecurityException in MyAuthenticationPlugin the message is not received by
OrderWatcherPlugin, as expected.

I was wondering if the order in which i add plugins is always the order in
which the message is processed by the plugins?

What i mean: now MyAuthenticationPlugin gets the message first, next
OrderWatcherPlugin. Will this always be the case or is it possible that
OrderWatcherPlugin will receive the message first and next
MyAuthenticationPlugin?

Kind regards,
T. Akhayo

Re: Order in which message is handled by broker plugins?

Posted by T Akhayo <t....@gmail.com>.
Hi Christian,

Thank you for your reply. I appreciate it.

Kind regards,
T. Akhayo


2013/3/20 Christian Posta <ch...@gmail.com>

> The plugins array is looped through and installed one at a time. But what
> it does is "wrap" the previous broker. So the plugins will see the message
> in the reverse order they are specified.
>
>
> On Wed, Mar 20, 2013 at 8:47 AM, T Akhayo <t....@gmail.com> wrote:
>
> > Good afternoon,
> >
> > I have a activemq server for my jms messages, i've created a custom
> > authentication plugin and installed it:
> > BrokerService broker = new BrokerService();
> > MyAuthenticationPlugin map=new MyAuthenticationPlugin();
> > broker.setPlugins(new BrokerPlugin[]{  map});
> >
> > Works nicely. Now i want to add a plugin that intercepts messages in the
> > send() method of BrokerFilter, this plugin will monitor all messages on
> all
> > topics and write a specific message to a database.
> >
> > No problem, just add another plugin:
> > BrokerService broker = new BrokerService();
> > MyAuthenticationPlugin map=new MyAuthenticationPlugin();
> > OrderWatcherPlugin owp=new OrderWatcherPlugin();
> > broker.setPlugins(new BrokerPlugin[]{ owp, map});
> >
> > Works nicely again. First the MyAuthenticationPlugin handles the message
> > next the OrderWatcherPlugin handles the message. When i throw a
> > SecurityException in MyAuthenticationPlugin the message is not received
> by
> > OrderWatcherPlugin, as expected.
> >
> > I was wondering if the order in which i add plugins is always the order
> in
> > which the message is processed by the plugins?
> >
> > What i mean: now MyAuthenticationPlugin gets the message first, next
> > OrderWatcherPlugin. Will this always be the case or is it possible that
> > OrderWatcherPlugin will receive the message first and next
> > MyAuthenticationPlugin?
> >
> > Kind regards,
> > T. Akhayo
> >
>
>
>
> --
> *Christian Posta*
> http://www.christianposta.com/blog
> twitter: @christianposta
>

Re: Order in which message is handled by broker plugins?

Posted by Christian Posta <ch...@gmail.com>.
The plugins array is looped through and installed one at a time. But what
it does is "wrap" the previous broker. So the plugins will see the message
in the reverse order they are specified.


On Wed, Mar 20, 2013 at 8:47 AM, T Akhayo <t....@gmail.com> wrote:

> Good afternoon,
>
> I have a activemq server for my jms messages, i've created a custom
> authentication plugin and installed it:
> BrokerService broker = new BrokerService();
> MyAuthenticationPlugin map=new MyAuthenticationPlugin();
> broker.setPlugins(new BrokerPlugin[]{  map});
>
> Works nicely. Now i want to add a plugin that intercepts messages in the
> send() method of BrokerFilter, this plugin will monitor all messages on all
> topics and write a specific message to a database.
>
> No problem, just add another plugin:
> BrokerService broker = new BrokerService();
> MyAuthenticationPlugin map=new MyAuthenticationPlugin();
> OrderWatcherPlugin owp=new OrderWatcherPlugin();
> broker.setPlugins(new BrokerPlugin[]{ owp, map});
>
> Works nicely again. First the MyAuthenticationPlugin handles the message
> next the OrderWatcherPlugin handles the message. When i throw a
> SecurityException in MyAuthenticationPlugin the message is not received by
> OrderWatcherPlugin, as expected.
>
> I was wondering if the order in which i add plugins is always the order in
> which the message is processed by the plugins?
>
> What i mean: now MyAuthenticationPlugin gets the message first, next
> OrderWatcherPlugin. Will this always be the case or is it possible that
> OrderWatcherPlugin will receive the message first and next
> MyAuthenticationPlugin?
>
> Kind regards,
> T. Akhayo
>



-- 
*Christian Posta*
http://www.christianposta.com/blog
twitter: @christianposta