org.axonframework.springmessaging.eventbus
Class SpringMessagingEventBus

java.lang.Object
  extended by org.axonframework.springmessaging.eventbus.SpringMessagingEventBus
All Implemented Interfaces:
EventBus

public class SpringMessagingEventBus
extends Object
implements EventBus

EventBus implementation that delegates all subscription and publishing requests to a Spring Messaging channel.

Use setChannel(org.springframework.messaging.SubscribableChannel) to set the channel to delegate all the requests to.

This EventBus will automatically wrap and unwrap events in Messages and EventListeners in MessageHandlers.

This implementation expects the Spring Messaging to be configured to handle messages asynchronously.

Since:
2.3.1
Author:
Allard Buijze

Constructor Summary
SpringMessagingEventBus()
           
 
Method Summary
 void publish(EventMessage... events)
          Publish a collection of events on this bus (one, or multiple).
 void setChannel(org.springframework.messaging.SubscribableChannel channel)
          Sets the Spring Messaging Channel that this event bus should publish events to.
 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

SpringMessagingEventBus

public SpringMessagingEventBus()
Method Detail

publish

public void publish(EventMessage... events)
Description copied from interface: EventBus
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.

Specified by:
publish in interface EventBus
Parameters:
events - The collection of events to publish

unsubscribe

public void unsubscribe(EventListener eventListener)
Description copied from interface: EventBus
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)
Description copied from interface: EventBus
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.

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

setChannel

public void setChannel(org.springframework.messaging.SubscribableChannel channel)
Sets the Spring Messaging Channel that this event bus should publish events to.

Parameters:
channel - the channel to publish events to


Copyright © 2010-2016. All Rights Reserved.