ActiveMQ has a sophisticated interceptor stack so that you can attach whatever functionality you require into the broker in an easy way without complicating all of the other broker code. This has really helped us keep the code clean and modular while offering powerful extension points.
For an example of the kinds of things you can do with interceptors see the following pages
A plugin is an instance of the interface BrokerPlugin which allows a plugin to add itself into the broker interceptor chain, typically using the BrokerFilter as a base class to allow only certain operations to be customized.
The object that implements the BrokerPlugin interface is called out as a plugin in the message broker's XML configuration file (see example below). Your plugin can then optionally reference other beans that are defined in the XML file.
You can also define plugins from within the <plugin> element as this example illustrates.
At startup, the main or core broker calls your plugin's installPlugin() method. This method creates and returns an object that typically extends BrokerFilter.
The BrokerFilter class is a convenience class that implements the Broker interface. This interface defines all the main operations (e.g., addConnection, addSession, etc.) that your implementation can intercept. The class that extends BrokerFilter overrides any of the methods that are defined in the Broker interface so that it can intercept the corresponding core engine's operations. Here's an example of a class that extends BrokerFilter and intercepts/overrides the addConnection() and addSession() Broker methods/operations.
For more details see Developing Plugins