Register a custom event provider

To process events generated by SPE processing through your host application, the application needs to register an event provider.

An event provider consists of two components:
  1. An event store provider, which is a Java class that implements the com.ibm.spe.core.events.IEventStoreProvider interface.
  2. An event store, which is a Java class that implements the com.ibm.spe.core.events.IEventStore interface. SPE includes an implementation (com.ibm.spe.core.events.SPEEventStore) that is sufficient to work with most event store providers.
Refer to the Javadoc files for details.
You can register an event provider in two ways: directly or indirectly.
  • Use the direct method if the event provider is not going to change, or the host application doesn't want the event provider to be overridden. Example call:
    SPE.registerProvider(IEventStoreProvider.PROVIDER_KEY, "yourEventProviderClassName");
  • Use the indirect method if the application allows overriding the event provider without having to recompile the application code. This method checks the customer_overrides.properties for the specified spePropertyName key and, if found, registers that event provider class name. Otherwise, it registers the defaultEventProviderClassName. Example call:
    SPE.registerProvider(IEventStoreProvider.PROVIDER_KEY, "defaultEventProviderClassName", "spePropertyName")
  1. Compile the event store provider Java classes and put them into a JAR file in the spe_install_dir/jars directory.
  2. Register the event store provider:
    • To register the provider directly, use the following call:
      SPE.registerProvider(IEventStoreProvider.PROVIDER_KEY, "yourEventProviderClassName");
    • To register the event provider indirectly, use the following call:
      SPE.registerProvider(IEventStoreProvider.PROVIDER_KEY, "defaultEventProviderClassName", "spePropertyName")
  3. To override the default event handler to be registered, edit the customer_overrides.properties file to add a property that points to the customer event provider.
    Example:
    spe.EventProvider=com.ibm.spe.myeventhandler.MyEventStoreProvider
    Requirement: The property key name (EventProvider) must match the value used in the registerProvider API method.

If properly registered, events generated during SPE processing (enveloping, de-enveloping, and so on) are sent to the registered event provider via the IEventStoreProvider.fireEvent method.