Community articleEvent SPI
Added by IBM contributorIBM on December 21, 2015
Rate this article 1 starsRate this article 2 starsRate this article 3 starsRate this article 4 starsRate this article 5 stars

The IBM® Connections Event SPI allows third parties to consume event data generated by IBM Connections.

The IBM® Connections Event SPI allows third parties to consume event data generated by IBM Connections.

In version 3, support was added for auditing and compliance. For more information about this support, see IBM Connections Audit and Compliance Enablement.
The Event SPI is an important part of auditing and compliance enablement. By contributing Java™ code written to this SPI, independent applications can plug into the creation, deletion, and update of content within IBM Connections, and in some cases influence the creation, deletion, or update of that content. There are various potential uses for the SPI, such as:

Using events to audit or log the activity in IBM Connections
Using events to gather statistical information about activity in IBM Connections
Pushing content from IBM Connections to other systems

What are events?

Events are collections of data generated when certain activities occur in the IBM Connections product. Typically, events are generated for any activity that represents the creation, update, or deletion of content, changes in access control or membership, and other such activity. Generally, read activity does not result in the generation of events. Events contain a set of standard metadata, as well as optional data sets that may be present for certain event types. Every event can also contain arbitrary properties. In the SPI, an event is represented by a Java Event interface. For a list of the events available in IBM Connections, see Events Reference.

What is an event handler?

An event handler is a independently contributed piece of code written to the Event SPI. There are two types of event handlers:

Pre-event handler

Pre-event handlers are always invoked at a point at which the action the event represents has not yet been committed. As such, pre-event handlers are capable of modifying some event data. In IBM Connections 3.0.1, pre-event handlers were only supported for certain moderation operations in certain applications. You should not expect any data modification made in a pre-event handler to be reflected in the system in all cases, or for all events to trigger these handlers. Pre-event handlers are always invoked synchronously, and therefore can directly impact the response times of the system.

Post-event handler

Post-event handlers are invoked after an action that the event represents has been committed, and therefore represent the result of an action. Post-event handlers have access to the same data as pre-event handlers, but the data is immutable. Post-event handlers can be configured to be invoked either synchronously or asynchronously. Synchronously-invoked handlers can directly impact the response times of the system. In almost all cases, post-event handlers should be registered asynchronously.

The use of pre-event handlers and synchronous post-event handlers is limited to certain system functions for moderation. Not all events within the system will trigger these handlers. Asynchronous post-event handlers are capable of being triggered for any event generated by the system.

See Programming an event handler for details about how to program an event handler. Documentation of the event handler SPI interfaces is available in the Event SPI Javadoc.

Event handler deployment and registration

Event handlers must be deployed to the IBM Connections system, and also registered in the events-config.xml configuration file. See Deploying an event handler for more details.

IBM Connections Audit and Compliance Enablement
IBM Connections 4 provides the capability to track all data change events in all IBM Connections components to help customers with their audit and compliance requirements. The data-change activities include all create, update, and delete (CUD) operations, and they are represented as real-time events with necessary data. The events can then be processed by a third-party tool using the SPIs provided by IBM Connections.

Events Reference
Lists events supported in IBM Connections.

Programming an event handler
Event handlers are Java code that executes within the context of the IBM Connections server. To write an event handler, you must implement the Event handler SPI interfaces. The Event handler SPI interfaces are contained in the file. More detailed information about the specific Event SPI interfaces referenced in this topic are contained in the Event SPI Javadoc.

Deploying an event handler
Deploy your event handler to the IBM Connections server runtime.

Updating or removing a post event handler
Remove (or disable) an event handler, previously added in events-config.xml. Note that removing pre-configured events handlers shipped with IBM Connections is not supported and may break Connections capabilities. Only third-party event handlers should be removed.

IBM Connections Event SPI
Refer to the Event SPI Javadoc for details about the event implementation.