A client can register a single or multiple callback functions that are invoked when the Event Server receives a new event. The client does this through the SPDHandleEvent function (see Section 6.6).
By default, a client can register only a single callback function for each new event. The callback event that is last registered is invoked whenever the event server receives a new event.
Registering to Receive Events
The client program must register a callback routine for each type of event you want it to receive. Clients can register to receive the following types of events:
Alert events
Attribute change events
Delete object events
Log events
Typically, a client uses the SPDHandleEvent function during its initialization phase to register a callback routine for each event that it receives. After the initialization is completed and the callbacks are registered, a client can call the SPDHandleEventDeregister function to deregister each callback function.
With the .NET architecture, threading for event callbacks are handled automatically and allow all events to be processed asynchronously. To simulate the legacy Operations Sentinel API that dedicates only the main thread to process all events, SPDProcessEvent function is provided for clients.
Data Structure of SPD_event
The callback reports the event in the SPD_event data structure. This data structure has an area for data that is common to all events (for example, object class and object name) and a separate area for event-specific data. The latter area is an object that can be cast to a specific structure for a single event. Since some events have variable amounts of data (for example, SPD_attributeChangeEvent), a variable data area is provided in the common area.