baroque package¶
Subpackages¶
Submodules¶
baroque.baroque module¶
-
class
baroque.baroque.
Baroque
(configfile=None)¶ Bases:
object
The Baroque event broker class.
Note
When no configuration file is specified, the default configuration is loaded.
Parameters: configfile (str, optional) – Path to the configuration YML file.
Raises: baroque.exceptions.configuration.ConfigurationNotFoundError
– when the supplied filepath is not a regular filebaroque.exceptions.configuration.ConfigurationParseError
– when the supplied file cannot be parsed
-
configuration
¶ dict
– the configuration for this broker instance
-
events
¶ baroque.datastructures.counters.EventCounter
– counter of events published on this broker instance so far
-
eventtypes
¶ baroque.datastructures.registries.EventTypesRegistry
– registry of event types registered on this broker instance
-
fire
(event)¶ Alias for baroque.baroque.Baroque.publish() method
-
on
(eventtype)¶ Registers an event type on the broker.
Parameters: eventtype ( baroque.entities.eventtype.EventType
) – the event type to be registeredReturns: baroque.datastructures.bags.ReactorsBag
-
on_any_event_run
(reactor)¶ Subscribes a reactor on the broker to be run upon any event firing.
Parameters: reactor ( baroque.entities.reactor.Reactor
) – the reactor to be subscribedReturns: baroque.datastructures.reactor.Reactor
-
on_any_event_trigger
(reactor)¶ Alias for baroque.baroque.Baroque.on_any_event_run() method
-
on_topic_run
(topic, reactor)¶ Attaches a reactor on a topic registered on the broker.
Parameters: - topic (
baroque.entities.topic.Topic
) – the topic to which the reactor must be attached - reactor (
baroque.entities.reactor.Reactor
) – the reactor to be attached to the topic
- topic (
-
publish
(event)¶ Publishes an event on the broker.
Note
This is a template-method
Parameters: event ( baroque.entities.event.Event
) – the event to be published
-
publish_on_topic
(event, topic)¶ Publishes an event on a specified topic registered on the broker.
Note
This is a template-method
Parameters: - event (
baroque.entities.event.Event
) – the event to be published on the topic - topic (
baroque.entities.topic.Topic
) – the topic on which the event must be published
- Raises
baroque.exceptions.topics.UnregisteredTopicError
: when trying to publish events on a topic that is not registered on the broker
- event (
-
reactors
¶ baroque.datastructures.registries.ReactorRegistry
– registry of reactors subscribed to this broker instance
-
reset
()¶ Resets the reactors register and the published events counter of this broker instance.
-
topics
¶ baroque.datastructures.registries.TopicsRegistry
– registry of topics registered on this broker instance
-
version
¶ tuple
– version tuple for this broker instance
baroque.constants module¶
Baroque costant values
Module contents¶
Export of Baroque main classes