blpapi.EventDispatcher

class blpapi.EventDispatcher(numDispatcherThreads=1)

Dispatches events from one or more Sessions through callbacks

EventDispatcher objects are optionally specified when Session objects are created. A single EventDispatcher can be shared by multiple Session objects.

The EventDispatcher provides an event-driven interface, generating callbacks from one or more internal threads for one or more sessions.

__init__(numDispatcherThreads=1)

Construct an EventDispatcher.

Parameters:

numDispatcherThreads (int) – Number of dispatcher threads

If numDispatcherThreads is 1 (the default) then a single internal thread is created to dispatch events. If numDispatcherThreads is greater than 1 then an internal pool of numDispatcherThreads threads is created to dispatch events. The behavior is undefined if numDispatcherThreads is 0.

destroy()

Destroy the handle using stored dtor

Return type:

None

isValid()

Returns: True if this class holds a handle and the handle is not None.

Return type:

bool

start()

Start generating callbacks for events from sessions associated with this EventDispatcher.

Return type:

int

stop(async_=False, **kwargs)

Stop generating callbacks.

Parameters:

async_ (bool) – Whether to execute this method asynchronously

Stop generating callbacks for events from sessions associated with this EventDispatcher. If the specified async_ is False (the default) then this method blocks until all current callbacks which were dispatched through this EventDispatcher have completed. If async_ is True, this method returns immediately and no further callbacks will be dispatched.

Return type:

int

Note

If stop is called with async_ of False from within a callback dispatched by this EventDispatcher then the async_ parameter is overridden to True.