org.axonframework.saga.annotation
Class AsyncSagaProcessingEvent

java.lang.Object
  extended by org.axonframework.saga.annotation.AsyncSagaProcessingEvent

public class AsyncSagaProcessingEvent
extends Object

Placeholder for information required by the AsyncSagaEventProcessor for processing Events.

Since:
2.0
Author:
Allard Buijze

Constructor Summary
AsyncSagaProcessingEvent()
           
 
Method Summary
 AssociationValue getAssociationValue()
          Returns the association value based on the handler.
 SagaMethodMessageHandler getHandler()
          Returns the handler that can process the published Event.
 AbstractAnnotatedSaga getNewSaga()
          Returns the new Saga instance that should be used when processing an Event that creates a new Saga instance
 EventMessage getPublishedEvent()
          Returns the event that has been published on the EventBus.
 Class<? extends Saga> getSagaType()
          Returns the type of Saga being processed.
 void reset(EventMessage event, Class<? extends AbstractAnnotatedSaga> sagaType, SagaMethodMessageHandler handler, AbstractAnnotatedSaga newSagaInstance)
          Reset this entry for processing a new EventMessage
 boolean waitForSagaCreationVote(boolean didEventInvocation, int processorCount, boolean ownsNewSagaInstance)
          Forces the current thread to wait for the voting to complete if it is responsible for creating the Saga.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AsyncSagaProcessingEvent

public AsyncSagaProcessingEvent()
Method Detail

getPublishedEvent

public EventMessage getPublishedEvent()
Returns the event that has been published on the EventBus. This is the event that will trigger Sagas.

Returns:
the event that has been published on the EventBus

getHandler

public SagaMethodMessageHandler getHandler()
Returns the handler that can process the published Event.

Returns:
the handler that can process the published Event

getAssociationValue

public AssociationValue getAssociationValue()
Returns the association value based on the handler.

Returns:
the association value based on the handler

getSagaType

public Class<? extends Saga> getSagaType()
Returns the type of Saga being processed.

Returns:
the type of Saga being processed

waitForSagaCreationVote

public boolean waitForSagaCreationVote(boolean didEventInvocation,
                                       int processorCount,
                                       boolean ownsNewSagaInstance)
Forces the current thread to wait for the voting to complete if it is responsible for creating the Saga. As soon as an invocation has been recorded, the waiting thread is released.

Parameters:
didEventInvocation - indicates whether the current processor found a Saga to process
processorCount - The total number of processors expected to cast a vote
ownsNewSagaInstance - Indicates whether the current processor "owns" the to-be-created saga instance.
Returns:
true if the current processor should create the new instance, false otherwise.

getNewSaga

public AbstractAnnotatedSaga getNewSaga()
Returns the new Saga instance that should be used when processing an Event that creates a new Saga instance

Returns:
the new Saga instance

reset

public void reset(EventMessage event,
                  Class<? extends AbstractAnnotatedSaga> sagaType,
                  SagaMethodMessageHandler handler,
                  AbstractAnnotatedSaga newSagaInstance)
Reset this entry for processing a new EventMessage

Parameters:
event - The EventMessage to process
sagaType - The type of Saga to process this EventMessage
handler - The handler handling this message
newSagaInstance - The saga instance to use when a new saga is to be created


Copyright © 2010-2012. All Rights Reserved.