ProjectionInterface
interface ProjectionInterface (View source)
Common interface for a Content Repository projection. This API is NOT exposed to the outside world, but is the contract between {ContentRepository} and the individual projections.
If the Projection needs to be notified that a catchup is about to happen, you can additionally implement {\Neos\ContentRepository\Core\Projection\WithMarkStaleInterface}. This is useful f.e. to disable runtime caches in the ProjectionState.
Methods
Set up the projection state (create databases, call CheckpointStorage::setup()).
Can the projection handle this event? Must be deterministic.
Catch up the projection, consuming the not-yet-seen events in the given event stream.
Part of the Blocking implementation of commands - usually delegates to an internal {CheckpointStorageInterface::getHighestAppliedSequenceNumber()}.
NOTE: The ProjectionStateInterface returned must be ALWAYS THE SAME INSTANCE.
No description
Details
void
setUp()
Set up the projection state (create databases, call CheckpointStorage::setup()).
bool
canHandle(Event $event)
Can the projection handle this event? Must be deterministic.
Used to determine whether this projection should be triggered in response to an event; and also needed as part of the Blocking logic ({\Neos\ContentRepository\Core\CommandHandler\PendingProjections}).
void
catchUp(EventStreamInterface $eventStream, ContentRepository $contentRepository)
Catch up the projection, consuming the not-yet-seen events in the given event stream.
How this is called depends a lot on your infrastructure - usually via some indirection from {\Neos\ContentRepository\Core\Projection\ProjectionCatchUpTriggerInterface}.
SequenceNumber
getSequenceNumber()
Part of the Blocking implementation of commands - usually delegates to an internal {CheckpointStorageInterface::getHighestAppliedSequenceNumber()}.
See {\Neos\ContentRepository\Core\CommandHandler\PendingProjections} for implementation details.
ProjectionStateInterface
getState()
NOTE: The ProjectionStateInterface returned must be ALWAYS THE SAME INSTANCE.
If the Projection needs to be notified that a catchup is about to happen, you can additionally implement {\Neos\ContentRepository\Core\Projection\WithMarkStaleInterface}. This is useful f.e. to disable runtime caches in the ProjectionState.
void
reset()
No description