|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.axonframework.eventhandling.replay.BackloggingIncomingMessageHandler
public class BackloggingIncomingMessageHandler
IncomingMessageHandler implementation that maintains a backlog of all Events published to a cluster while it is in replay mode. When the replay finishes, events in the backlog are processed. Events that have been replayed will be removed from the backlog, to prevent duplicate publication of events.
When a replay fails, the backlog is cleared. This means backlogged items will not be forwarded to the cluster for handling. Note that a single BackloggingIncomingMessageHandler should *not* be used for multiple Clusters. Each cluster must have its own instance of BackloggingIncomingMessageHandler.
| Constructor Summary | |
|---|---|
BackloggingIncomingMessageHandler()
Creates a new BackloggingIncomingMessageHandler. |
|
BackloggingIncomingMessageHandler(org.joda.time.Duration backlogThresholdMargin)
Creates a new BackloggingIncomingMessageHandler. |
|
| Method Summary | |
|---|---|
void |
onIncomingMessages(Cluster destination,
EventMessage... messages)
Invoked while the ReplayingCluster is in replay mode and an Event is being dispatched to the Cluster. |
void |
onReplayFailed(Cluster destination,
RuntimeException cause)
Invoked when a replay has failed. |
void |
prepareForReplay(Cluster destination)
Invoked just before replay mode is activated. |
void |
processBacklog(Cluster destination)
Invoked when all events from the Event Store have been processed. |
void |
releaseMessage(DomainEventMessage message)
Invoked when a message has been replayed from the event store. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public BackloggingIncomingMessageHandler()
BackloggingIncomingMessageHandler(org.joda.time.Duration) constructor to provide a margin that better suits
the latency.
public BackloggingIncomingMessageHandler(org.joda.time.Duration backlogThresholdMargin)
backlogThresholdMargin indicates the
age that an event may have to be backlogged. Older events will not be backlogged, as we may assume they will be
part of the replay process.
A good starting value for this is the maximum expected latency of incoming events.
backlogThresholdMargin - The margin of time to take into account when backlogging events.| Method Detail |
|---|
public void prepareForReplay(Cluster destination)
IncomingMessageHandlerIncomingMessageHandler.onIncomingMessages(org.axonframework.eventhandling.Cluster, org.axonframework.domain.EventMessage[])
prior to this method invocation should be dispatched immediately to the destination cluster to prevent message
loss.
This method is invoked in the thread that executes the replay process.
prepareForReplay in interface IncomingMessageHandlerdestination - The cluster on which events are about te be replayed
public void onIncomingMessages(Cluster destination,
EventMessage... messages)
IncomingMessageHandlermessage is before the timestamp of any message reported via IncomingMessageHandler.releaseMessage(org.axonframework.domain.DomainEventMessage), consider discarding the incoming message.
This method is invoked in the thread that attempts to publish the given messages to the given destination.
onIncomingMessages in interface IncomingMessageHandlerdestination - The cluster to receive the messagemessages - The messages to dispatch to the clusterpublic void releaseMessage(DomainEventMessage message)
IncomingMessageHandlerIncomingMessageHandler.onIncomingMessages(org.axonframework.eventhandling.Cluster, org.axonframework.domain.EventMessage[]), it
should
be discarded.
After this invocation, any invocation of IncomingMessageHandler.onIncomingMessages(org.axonframework.eventhandling.Cluster,
org.axonframework.domain.EventMessage[]) with a message who's timestamp is lower that this message's timestamp
can be safely discarded.
This method is invoked in the thread that executes the replay process
releaseMessage in interface IncomingMessageHandlermessage - The message replayed from the event store
public void onReplayFailed(Cluster destination,
RuntimeException cause)
IncomingMessageHandler
onReplayFailed in interface IncomingMessageHandlerdestination - The destination cluster to dispatch backlogged messages to, if appropriate in this scenariocause - The cause of the failurepublic void processBacklog(Cluster destination)
IncomingMessageHandlerIncomingMessageHandler.onIncomingMessages(org.axonframework.eventhandling.Cluster,
org.axonframework.domain.EventMessage[]) should be dispatched to the given delegate. Transactions
started by the replay process have been committed or rolled back prior to the invocation of this method.
Note that IncomingMessageHandler.onIncomingMessages(org.axonframework.eventhandling.Cluster,
org.axonframework.domain.EventMessage[]) may be invoked during or after the invocation of this method. These
messages must be dispatched by this handler to prevent message loss.
This method is invoked in the thread that executes the replay process
processBacklog in interface IncomingMessageHandlerdestination - The destination cluster to dispatch backlogged messages to
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||