baroque package

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:
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 registered
Returns: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 subscribed
Returns: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:
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:
Raises
baroque.exceptions.topics.UnregisteredTopicError: when trying to publish events on a topic that is not registered on the broker
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