I
- the type of the process manager IDsS
- the type of the process manager statepublic abstract class ProcessManager<I,S extends io.spine.base.EntityState,B extends io.spine.protobuf.ValidatingBuilder<S>> extends CommandHandlingEntity<I,S,B> implements EventReactor, Commander, HasVersionColumn<I,S>, HasLifecycleColumns<I,S>
A process manager reacts to domain events in a cross-aggregate, eventually consistent manner.
Event and command handlers are invoked by the ProcessManagerRepository
that manages instances of a process manager class.
For more information on Process Managers, please see:
Entity.GenericParameter
Modifier | Constructor and Description |
---|---|
protected |
ProcessManager()
Creates a new instance.
|
protected |
ProcessManager(I id)
Creates a new instance.
|
Modifier and Type | Method and Description |
---|---|
protected B |
builder()
Obtains the instance of the state builder.
|
protected io.spine.server.dispatch.DispatchOutcome |
dispatchCommand(CommandEnvelope command)
Dispatches the command to the handling method.
|
protected java.lang.String |
missingTxMessage()
Provides error message text for the case of not having an active transaction when a state
modification call is made.
|
com.google.common.collect.ImmutableSet<EventClass> |
producedEvents()
Obtains classes of the events produced by this object.
|
protected ProcessManagerClass<?> |
thisClass()
Obtains model class for this entity.
|
protected Transaction<I,? extends TransactionalEntity<I,S,B>,S,B> |
tx()
Obtains the transaction used for modifying the entity.
|
expectedDefault, expectedEmpty, expectedNotDefault, expectedNotDefault, expectedNotEmpty, producerId, unexpectedValue, unexpectedValue
clearRecentHistory, getLifecycleFlags, recentHistory, remember, setArchived, setDeleted, setInitialState
afterInvoke, at, beforeInvoke, checkEntityState, checkNotArchived, checkNotDeleted, defaultState, equals, hashCode, id, idAsString, isArchived, isDeleted, lifecycleFlagsChanged, state, toString, version, versionNumber, whenModified
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
nothing, producerId, version
isActive, lifecycleFlags
protected ProcessManager()
protected ProcessManager(I id)
id
- an ID for the new instanceprotected ProcessManagerClass<?> thisClass()
AbstractEntity
thisClass
in class AbstractEntity<I,S extends io.spine.base.EntityState>
public com.google.common.collect.ImmutableSet<EventClass> producedEvents()
EventProducer
producedEvents
in interface EventProducer
protected final B builder()
This method must be called only from within an active transaction.
In ProcessManager
, this method must be called from an event reactor, a rejection
reactor, or a command handler.
builder
in class TransactionalEntity<I,S extends io.spine.base.EntityState,B extends io.spine.protobuf.ValidatingBuilder<S>>
java.lang.IllegalStateException
- if the method is called from outside an event/rejection reactor or a command handlerVisibleForTesting
to allow package-local use of this method in tests.
It does not affect the visibility for inheritors which stays protected
as originally
defined in parents.
See IDEA issue
for reason behind the warning.protected Transaction<I,? extends TransactionalEntity<I,S,B>,S,B> tx()
The method is overridden to be accessible from the procman
package.
protected io.spine.server.dispatch.DispatchOutcome dispatchCommand(CommandEnvelope command)
dispatchCommand
in class CommandHandlingEntity<I,S extends io.spine.base.EntityState,B extends io.spine.protobuf.ValidatingBuilder<S>>
command
- the envelope with the command to dispatchprotected java.lang.String missingTxMessage()
TransactionalEntity
missingTxMessage
in class TransactionalEntity<I,S extends io.spine.base.EntityState,B extends io.spine.protobuf.ValidatingBuilder<S>>