Provides backplanes for publisher/subscriber interactions.
Bases: m4us.core.exceptions.M4USException
Raised when a publisher has attempted to register more than once.
The default message requires a publisher attribute or keyword argument.
See also
The IBackplane interface for details about this exeption's usage.
Bases: m4us.core.exceptions.M4USException
Raised when a publisher has not been registered by a backplane.
The default message requires a publisher attribute or keyword argument.
See also
The IBackplane interface for details about this exeption's usage.
Bases: m4us.core.components.Component
Component that registers with a backplane before sending messages.
IBackplane coroutines expect that registration and un-registration messages will be sent by publishers before and after usage. This component handles those actions transparently. Just link this component's outbox and signal outboxes to the backplane's inbox and control inboxes.
This is usually all handled automatically by the publish_to() function.
Messages sent to this class will be forwarded back out, but only after an IRegisterPublisher message is emitted first. Similarily, before an IShutdown message is forwarded on, an IUnregisterPublisher message is emitted first.
Implements : | m4us.core.interfaces.ICoroutine and m4us.core.interfaces.INotLazy |
---|---|
Provides : | m4us.core.interfaces.ICoroutineFactory |
See also
The publish_to() function for the normal way to publish to a backplane.
See also
The RegisterPublisher and UnregisterPublisher classes as examples of concrete classes that publishers can use for registration and unregistration.
Bases: m4us.core.messages.Message
Message for registering publishers with backplanes.
Parameters: | publisher -- The publishing object, specified as a keyword argument. |
---|---|
Implements : | m4us.interfaces.IRegisterPublisher |
Provides : | m4us.core.interfaces.IMessageFactory |
See also
The Publisher component and the IBackplane interface for details about how this message is used.
Bases: m4us.backplanes.RegisterPublisher
Message for unregistering publishers with backplanes.
Parameters: | publisher -- The publishing object, specified as a keyword argument. |
---|---|
Implements : | m4us.interfaces.IUnregisterPublisher |
Provides : | m4us.core.interfaces.IMessageFactory |
See also
The Publisher component and the IBackplane interface for details about how this message is used.
A backplane lets publishers send messages to subscribers.
To create a backplane, just call this function and store the resulting backplane coroutine. Then make the backplane available for import by any publishing and subscribing modules.
To publish messages to the backplane, use the publish_to() function.
To subscribe to a backplane, just link to the backplane's outbox and signal outboxes like any other publisher coroutine.
Implements : | m4us.interfaces.IBackplane |
---|---|
Provides : | m4us.interfaces.IBackplaneFactory |
See also
The IBackplane interface for more details on backplanes.
Return a component that can publish messages to the backplane.
This is just a convenience function that returns a Pipeline of a Publisher component, the given backplane() object and a null_sink() coroutine.
Parameters: | backplane (m4us.interfaces.IBackplane) -- The backplane object to which to publish messages. |
---|---|
Returns: | A container component that will publish all sent messages to the given backplane. |
Return type: | m4us.core.containers.Pipeline |
Note
Since this function returns an IContainer component, remember to register it's coroutines and links with the scheduler and post office, or include it in another container.