public interface MessageBus extends Disposable
push messages;create connections for further subscriptions;
ComponentManager.getMessageBus() to obtain one.
Please see Messaging Infrastructure and
Plugin Listeners.Disposable.Parent| Modifier and Type | Method and Description |
|---|---|
MessageBusConnection |
connect()
Allows to create new connection that is not bound to any
Disposable. |
MessageBusConnection |
connect(Disposable parentDisposable)
Allows to create new connection that is bound to the given
Disposable. |
void |
dispose()
Disposes current bus, i.e.
|
MessageBus |
getParent()
Message buses can be organised into hierarchies.
|
boolean |
hasUndeliveredEvents(Topic<?> topic) |
boolean |
isDisposed()
Returns true if this bus is disposed.
|
<L> L |
syncPublisher(Topic<L> topic)
Allows to retrieve an interface for publishing messages to the target topic.
|
MessageBus getParent()
broadcasting.
Current method exposes parent bus (if any is defined).MessageBusConnection connect()
Disposable.MessageBusConnection connect(Disposable parentDisposable)
Disposable. That means that returned connection
will be automatically released if given disposable parent is collected.parentDisposable - target parent disposable to which life cycle newly created connection shall be bound<L> L syncPublisher(Topic<L> topic)
connections within the target message bus and
subscribe to the target topics;
business interface of the target topic. Every method call on that
object is dispatched by the messaging infrastructure to the subscribers.
broadcasting is performed if necessary as well;
Subscriber1 and subscriber2 are registered for the same topic within
the same message bus;
Message1 is sent to that topic within the same message bus;Message1 is queued for delivery to both subscribers;Message1 is being delivered to the subscriber1;Subscriber1 sends message2 to the same topic within the same bus;subscriber2 is being notified about all queued but not delivered messages,
i.e. its callback is invoked for the message1;
message1;Message2 is queued for delivery to both subscribers;Subscriber1 is notified on message2Subscriber2 is notified on message2'per-topic' manner.
That means that caller of this method is not obliged to keep returned reference along with the reference to the message for
further publishing. It's enough to keep reference to the message bus only and publish
like 'messageBus.syncPublisher(targetTopic).targetMethod()'.L - business interface of the target topictopic - target topicvoid dispose()
connections.dispose in interface Disposableboolean isDisposed()
boolean hasUndeliveredEvents(Topic<?> topic)