You can implement a custom filter plug-in.
Why and when to perform this task
If you want to use your own filtering engine as an emitter filter,
you can implement a custom filter plug-in by following these steps:
Steps for this task
- Develop your filter plug-in as a Java class implementing the interface
com.ibm.events.filter.Filter. This interface defines the following
methods:
- isEventEnabled(CommonBaseEvent)
- Returns a boolean value indicating whether the specified event passes
the filter criteria. Each time an event is submitted to an emitter, the emitter
calls this method, passing the submitted event. If the return value is true,
the emitter sends the event to the event server for persistence and distribution.
If the return value is false, the emitter discards the event.
- getMetaData()
- Returns information about the filter plug-in, such as the provider name
and version number.
- close()
- Frees all resources used by the filter plug-in. This method is called
when the close() method of an emitter is called.
- Develop a filter factory class that implements the interface com.ibm.events.filter.FilterFactory. This interface defines a single method, getFilter(), which returns an
instance of your filter class (an implementation of the Filter interface).
- Bind an instance of your filter factory into a JNDI namespace. During initialization, an emitter performs a JNDI lookup to access the
filter factory.
- In the WebSphere ESB administrative console, modify
your emitter factory profile or create a new profile. In the Filter
Factory JNDI Name field, specify the JNDI name of your FilterFactory implementation.
For more information about emitter factory profiles, see the online help for
the administrative console.
Result
When you create an emitter using the emitter factory profile that
specifies your filter factory, the new emitter uses an instance of your filter
implementation. You can now send events using the standard emitter interfaces,
and your filter plug-in is used.