org.axonframework.eventhandling
Interface EventBus

All Known Implementing Classes:
ClusteringEventBus, SimpleEventBus, SimpleEventBusWithoutStatistics, SpringIntegrationEventBus, SpringMessagingEventBus

public interface EventBus

Specification of the mechanism on which the Event Listeners can subscribe for events and event publishers can publish their events. The event bus dispatches events to all subscribed listeners.

Implementations may or may not dispatch the events to event listeners in the dispatching thread.

Since:
0.1
Author:
Allard Buijze
See Also:
EventListener, SimpleEventBus, ClusteringEventBus

Method Summary
 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.
 

Method Detail

publish

void publish(EventMessage... events)
Publish a collection of events on this bus (one, or multiple). The events will be dispatched to all subscribed listeners.

Implementations may treat the given events as a single batch and distribute the events as such to all subscribed EventListeners.

Parameters:
events - The collection of events to publish

subscribe

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

If the given eventListener is already subscribed, nothing happens.

Parameters:
eventListener - The event listener to subscribe
Throws:
EventListenerSubscriptionFailedException - if the listener could not be subscribed

unsubscribe

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

Parameters:
eventListener - The event listener to unsubscribe


Copyright © 2010-2016. All Rights Reserved.