ait.core.server.broker module¶
-
class
ait.core.server.broker.
Broker
¶ Bases:
gevent._gevent_cgreenlet.Greenlet
This broker contains the ZeroMQ context and proxy that connects all streams and plugins to each other through publish-subscribe sockets. This broker subscribes all ZMQ clients to their input topics.
-
__init__
()¶ Parameters: - args – The arguments passed to the
run
function. - kwargs – The keyword arguments passed to the
run
function. - run (callable) – The callable object to run. If not given, this object’s _run method will be invoked (typically defined by subclasses).
Changed in version 1.1b1: The
run
argument to the constructor is now verified to be a callable object. Previously, passing a non-callable object would fail after the greenlet was spawned.Changed in version 1.3b1: The
GEVENT_TRACK_GREENLET_TREE
configuration value may be set to a false value to disablespawn_tree_locals
,spawning_greenlet
, andspawning_stack
. The first two will be None in that case, and the latter will be empty.Changed in version 1.5: Greenlet objects are now more careful to verify that their
parent
is really a gevent hub, raising aTypeError
earlier instead of anAttributeError
later.Changed in version 20.12.1: Greenlet objects now function as context managers. Exiting the
with
suite ensures that the greenlet has completed byjoining
the greenlet (blocking, with no timeout). If the body of the suite raises an exception, the greenlet iskilled
with the default arguments and not joined in that case.- args – The arguments passed to the
-
static
subscribe
(subscriber, publisher)¶ Sets subscriber’s socket option to include the publisher as topic.
- Args:
- subscriber: ZMQInputClient with subscription socket publisher: Object whose str() method returns its associated topic
-
subscribe_to_output
(output_name, topic_name)¶ Performs a lookup for an output stream by name and if found, subscribes it to the publisher topic name. Otherwise a warning is logged that output stream could not be found.
- Params:
- output_name: Subscriber/output name topic_name: Publisher/topic name
- Returns:
- True if lookup and subscription were successful, False otherwise
-
inbound_streams
= []¶
-
outbound_streams
= []¶
-
plugins
= []¶
-
servers
= []¶
-