Click or drag to resize
ISessionSetEventHandler Method

Note: This API is now obsolete.

Deprecated: Set event-specific event handlers.

Namespace:  Bloomberglp.Blpapi
Assembly:  Bloomberglp.Blpapi (in Bloomberglp.Blpapi.dll) Version: 3.25.11.64-experimental+d519cd77c15f00eb425bcde0dbe3273921f5910b
Syntax
[ObsoleteAttribute("SetEventHandler is not supported in the C# FFI version and will throw at runtime.", 
	true)]
void SetEventHandler(
	EventHandler eventHandler,
	EventEventType eventType
)

Parameters

eventHandler
Type: Bloomberglp.BlpapiEventHandler
New event handler to replace default event handler provided at construction.
eventType
Type: Bloomberglp.BlpapiEventEventType
Type of events to be delivered to the new handler.
Remarks
Warning: This method is not supported in the C# FFI version and will throw at runtime. Alternative: In the C# FFI version, you can implement a general event handler that checks the event type and dispatches to the appropriate logic, like so:
private void ProcessEvent(Event eventObj, Session session)
{
    try
    {
        Console.WriteLine($"Processing {eventObj.Type}");
        switch (eventObj.Type)
        {
            case EventType.SUBSCRIPTION_DATA:
                ProcessSubscriptionDataEvent(eventObj);
                break;
            case EventType.SUBSCRIPTION_STATUS:
                ProcessSubscriptionStatus(eventObj);
                break;
            default:
                ProcessGenericMessage(eventObj);
                break;
        }
    }
    catch (Exception e)
    {
        Console.WriteLine($\"Failed to process event {eventObj}: {e}\");
    }
}
See Also