public class SimpleEventBus extends Object implements EventBus
EventBus
that directly forwards all published events (in the callers' thread) to all
subscribed listeners.
Listeners are expected to implement asynchronous handling themselves.Constructor and Description |
---|
SimpleEventBus()
Initializes the SimpleEventBus and registers the mbeans for management information.
|
Modifier and Type | Method and Description |
---|---|
void |
publish(EventMessage... events)
Publish a collection of events on this bus (one, or multiple).
|
void |
subscribe(EventListener eventListener)
Subscribe the given
eventListener to this bus. |
void |
unsubscribe(EventListener eventListener)
Unsubscribe the given
eventListener to this bus. |
public SimpleEventBus()
public void unsubscribe(EventListener eventListener)
eventListener
to this bus. When unsubscribed, it will no longer receive
events
published to this bus.unsubscribe
in interface EventBus
eventListener
- The event listener to unsubscribepublic void subscribe(EventListener eventListener)
eventListener
to this bus. When subscribed, it will receive all events
published to this bus.
If the given eventListener
is already subscribed, nothing happens.public void publish(EventMessage... events)
events
as a single batch and distribute the events as such to
all subscribed EventListeners.Copyright © 2010-2014. All Rights Reserved.