public interface MessageBusConnection extends Disposable
message bus. I.e. every time a client wants to
listen for messages it should grab appropriate connection (or create a new one) and subscribe
to particular endpoint.Disposable.Parent| Modifier and Type | Method and Description |
|---|---|
void |
deliverImmediately()
Forces to process any queued but not delivered events.
|
void |
disconnect()
Disconnects current connections from the
message bus and drops all queued but not dispatched messages (if any) |
void |
setDefaultHandler(MessageHandler handler)
Allows to specify default handler to use during
anonymous subscriptions. |
<L> void |
subscribe(Topic<L> topic)
Subscribes to the target topic within the current connection using
default handler. |
<L> void |
subscribe(Topic<L> topic,
L handler)
Subscribes given handler to the target endpoint within the current connection.
|
dispose<L> void subscribe(Topic<L> topic, L handler) throws java.lang.IllegalStateException
L - interface for working with the target topictopic - target endpointhandler - target handler to use for incoming messagesjava.lang.IllegalStateException - if there is already registered handler for the target endpoint within the current connection.
Note that that previously registered handler is not replaced by the given one thenMessageBus.syncPublisher(Topic),
com.intellij.application.Topics#subscribe<L> void subscribe(Topic<L> topic) throws java.lang.IllegalStateException
default handler.L - interface for working with the target topictopic - target endpointjava.lang.IllegalStateException - if default handler hasn't been defined or
has incompatible type with the topic's business interface
or if target topic is already subscribed within the current connectionvoid setDefaultHandler(MessageHandler handler)
anonymous subscriptions.handler - handler to usevoid deliverImmediately()
MessageBus.syncPublisher(Topic)void disconnect()
message bus and drops all queued but not dispatched messages (if any)