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 singleEventDispatcher
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
is1
(the default) then a single internal thread is created to dispatch events. IfnumDispatcherThreads
is greater than1
then an internal pool ofnumDispatcherThreads
threads is created to dispatch events. The behavior is undefined ifnumDispatcherThreads
is0
.
- 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 thisEventDispatcher
have completed. Ifasync_
isTrue
, this method returns immediately and no further callbacks will be dispatched.Note
If stop is called with
async_
ofFalse
from within a callback dispatched by thisEventDispatcher
then theasync_
parameter is overridden toTrue
.- Return type