EntityLifecycle

public class EntityLifecycle

The lifecycle callbacks of an Entity.

On each call, posts from zero to several system commands. See the individual method descriptions for more info about the posted commands.

An instance of EntityLifecycle is associated with a single instance of entity.

See also

Repository.lifecycleOf(I)

Constructors

Link copied to clipboard
protected void EntityLifecycle(Object entityId, TypeUrl entityType, SystemWriteSide writeSide, EventFilter eventFilter, EntityTypeName typeName)
Creates a new instance.

Functions

Link copied to clipboard
public final void onCommandHandled(Command command)
Posts the CommandHandled system event.
Link copied to clipboard
public final void onCommandRejected(CommandId commandId, Event rejection)
Posts the CommandRejected system event.
Link copied to clipboard
public void onCorruptedState(BatchDispatchOutcome outcome)
Link copied to clipboard
public final void onDispatchCommand(Command command)
Posts the io.spine.system.server.event.
Link copied to clipboard
public final void onDispatchEventToReactor(Event event)
Posts the EventDispatchedToReactor system event.
Link copied to clipboard
public final void onDispatchEventToSubscriber(Event event)
Posts the EventDispatchedToSubscriber system event.
Link copied to clipboard
public final void onDispatchingFailed(SignalEnvelope<? extends Object, ? extends Object, ? extends Object> signal, Error error)
Posts a diagnostic event on a dispatching error.
Link copied to clipboard
public void onDuplicateCommand(CommandEnvelope command)
Link copied to clipboard
public void onDuplicateEvent(EventEnvelope event)
Link copied to clipboard
public final void onEntityCreated(Kind entityKind)
Posts the EntityCreated system event.
Link copied to clipboard
public final void onEventImported(Event event)
Link copied to clipboard
public final void onInvalidEntity(MessageId lastMessage, MessageId root, ValidationError error, Version version)
Posts the ConstraintViolated system event.
Link copied to clipboard
public final Optional<Event> onMigrationApplied()
Posts the MigrationApplied event.
Link copied to clipboard
public final void onRemovedFromStorage(Iterable<MessageId> signalIds)
Posts the EntityDeleted event signaling that the entity record was removed from the storage.
Link copied to clipboard
public final void onStateChanged(EntityRecordChange change, Set<? extends MessageId> messageIds, Origin origin)
Posts the EntityStateChanged system event and the events related to the lifecycle flags.
Link copied to clipboard
public final void onTargetAssignedToCommand(CommandId commandId)
Posts the TargetAssignedToCommand system command.
Link copied to clipboard
protected Optional<Event> postEvent(EventMessage event)
Posts an event to a system write side.
protected Optional<Event> postEvent(EventMessage event, Origin explicitOrigin)
Posts a system event with the specified origin.