org.axonframework.eventhandling
Class SimpleEventBus

java.lang.Object
  extended by org.axonframework.eventhandling.SimpleEventBus
All Implemented Interfaces:
EventBus

public class SimpleEventBus
extends Object
implements EventBus

Implementation of the EventBus that directly forwards all published events (in the callers' thread) to all subscribed listeners.

Listeners are expected to implement asynchronous handling themselves.

Since:
0.5
Author:
Allard Buijze
See Also:
AsynchronousEventHandlerWrapper

Constructor Summary
SimpleEventBus()
          Initializes the SimpleEventBus and registers the mbeans for management information.
SimpleEventBus(boolean registerMBeans)
          Initiates the SimpleEventBus and makes the registration of mbeans for management information optional.
 
Method Summary
 void publish(Event event)
          Publish an event on this bus.
 void subscribe(EventListener eventListener)
          Subscribe the given eventListener to this bus.
 void unsubscribe(EventListener eventListener)
          Unsubscribe the given eventListener to this bus.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SimpleEventBus

public SimpleEventBus()
Initializes the SimpleEventBus and registers the mbeans for management information.


SimpleEventBus

public SimpleEventBus(boolean registerMBeans)
Initiates the SimpleEventBus and makes the registration of mbeans for management information optional.

Parameters:
registerMBeans - true to register the mbeans, false for not registering them.
Method Detail

unsubscribe

public void unsubscribe(EventListener eventListener)
Unsubscribe the given eventListener to this bus. When unsubscribed, it will no longer receive events published to this bus.

Specified by:
unsubscribe in interface EventBus
Parameters:
eventListener - The event listener to unsubscribe

subscribe

public void subscribe(EventListener eventListener)
Subscribe the given eventListener to this bus. When subscribed, it will receive all events published to this bus.

Specified by:
subscribe in interface EventBus
Parameters:
eventListener - The event listener to subscribe

publish

public void publish(Event event)
Publish an event on this bus. It is dispatched to all subscribed event listeners.

Specified by:
publish in interface EventBus
Parameters:
event - the event to publish


Copyright © 2011. All Rights Reserved.