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.akhayo@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