blpapi.EventDispatcher
- class blpapi.EventDispatcher(numDispatcherThreads=1)
Dispatches events from one or more Sessions through callbacks
EventDispatcherobjects are optionally specified when Session objects are created. A singleEventDispatchercan be shared by multiple Session objects.The
EventDispatcherprovides 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
numDispatcherThreadsis1(the default) then a single internal thread is created to dispatch events. IfnumDispatcherThreadsis greater than1then an internal pool ofnumDispatcherThreadsthreads is created to dispatch events. The behavior is undefined ifnumDispatcherThreadsis0.
- start()
Start generating callbacks for events from sessions associated with this
EventDispatcher.- Return type:
- 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 specifiedasync_isFalse(the default) then this method blocks until all current callbacks which were dispatched through thisEventDispatcherhave completed. Ifasync_isTrue, this method returns immediately and no further callbacks will be dispatched.- Return type:
Note
If stop is called with
async_ofFalsefrom within a callback dispatched by thisEventDispatcherthen theasync_parameter is overridden toTrue.