|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.axonframework.eventhandling.replay.ReplayingCluster
public class ReplayingCluster
Cluster implementation that wraps another Cluster, adding the capability to replay events from an Event Store. All
events are forwarded for handling to a delegate cluster. When in replay mode, incoming events are forwarded to an
IncomingMessageHandler, which defines the behavior for these events.
startReplay()) or asynchronously by providing an
Executor (see startReplay(java.util.concurrent.Executor)).
Note that this cluster will replay each event on all subscribed listeners, even those that do not implement the
ReplayAware interface. If a listener does not support replaying at all, it should not be
subscribed to either this cluster or the delegate.
| Constructor Summary | |
|---|---|
ReplayingCluster(Cluster delegate,
EventStoreManagement eventStore,
TransactionManager transactionManager,
int commitThreshold,
IncomingMessageHandler incomingMessageHandler)
Initializes a ReplayingCluster that wraps the given delegate, to allow it to replay event from the
given eventStore. |
|
| Method Summary | |
|---|---|
Set<EventListener> |
getMembers()
Returns a read-only view on the members in the cluster. |
ClusterMetaData |
getMetaData()
Returns the MetaData of this Cluster. |
String |
getName()
Returns the name of this cluster. |
boolean |
isInReplayMode()
Indicates whether this cluster is in replay mode. |
void |
publish(EventMessage... events)
Publishes the given Events to the members of this cluster. |
void |
startReplay()
Starts a replay process on the current thread. |
Future<Void> |
startReplay(Executor executor)
Starts a replay process using the given executor. |
void |
subscribe(EventListener eventListener)
Subscribe the given eventListener to this cluster. |
void |
unsubscribe(EventListener eventListener)
Unsubscribes the given eventListener from this cluster. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public ReplayingCluster(Cluster delegate,
EventStoreManagement eventStore,
TransactionManager transactionManager,
int commitThreshold,
IncomingMessageHandler incomingMessageHandler)
delegate, to allow it to replay event from the
given eventStore. The given transactionManager is used to create a transaction for the
replay process. While in replay mode, the given incomingMessageHandler receives all Event Messages
being published to this instance. The given commitThreshold indicates how many events may be
processed within the same transaction. Values of 0 (zero) and negative values will prevent intermediate commits
altogether.
delegate - The cluster to add replaying capability toeventStore - The event store providing access to events to replaytransactionManager - The transaction manager providing the transaction for the replay processcommitThreshold - The number of messages to process before doing an intermediate commit (0 and
negative values prevent intermediate commits)incomingMessageHandler - The handler to receive Messages while in replay mode| Method Detail |
|---|
public void startReplay()
ReplayFailedException - when an exception occurred during the replay processpublic Future<Void> startReplay(Executor executor)
executor. The replay process itself uses a single thread.
executor - The executor to execute the replay process
public boolean isInReplayMode()
true if this cluster is in replay mode, false otherwise.public String getName()
Cluster
getName in interface Clusterpublic void publish(EventMessage... events)
ClusterEventListeners are
discouraged to throw exceptions, it is possible that they are propagated through this method invocation. In that
case, no guarantees can be given about the delivery of Events at all Cluster members.
publish in interface Clusterevents - The Events to publish in the clusterpublic void subscribe(EventListener eventListener)
eventListener to this cluster. If the listener is already subscribed, nothing
happens.
While the Event Listeners is subscribed, it will receive all messages published to the cluster.
If the given eventListener implements ReplayAware, its ReplayAware.beforeReplay() and ReplayAware.afterReplay() methods will be invoked before and after the replay process,
respectively.
EventListeners that are subscribed while the cluster is in replay mode might receive some of the
replayed events and might not have their ReplayAware.beforeReplay() method invoked.
subscribe in interface ClustereventListener - the Event Listener instance to subscribeisInReplayMode()public void unsubscribe(EventListener eventListener)
eventListener from this cluster. If the listener is already unsubscribed, or was
never subscribed, nothing happens.
If the given eventListener implements ReplayAware and is unsubscribed during
replay, it might not have its ReplayAware.afterReplay() method invoked when the
replay process is finished.
unsubscribe in interface ClustereventListener - the Event Listener instance to unsubscribeisInReplayMode()public Set<EventListener> getMembers()
Cluster
getMembers in interface Clusterpublic ClusterMetaData getMetaData()
Cluster
getMetaData in interface Cluster
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||