ContentRepositoryMaintainer
final class ContentRepositoryMaintainer implements ContentRepositoryServiceInterface (View source)
Set up and manage a content repository
Initialisation / Tear down
The method {\Neos\ContentRepository\Core\Service\setUp} sets up the content repository like event store and subscription database tables. It is non-destructive.
Resetting a content repository with {\Neos\ContentRepository\Core\Service\prune} method will purge the event stream and reset all subscription states.
Status information
The status of the content repository e.g. if a setup is required or if all subscriptions are active and their position can be examined with {\Neos\ContentRepository\Core\Service\status}
The event store status is available via {\Neos\ContentRepository\Core\SharedModel\ContentRepository\ContentRepositoryStatus::$eventStoreStatus}, and the subscription status via {\Neos\ContentRepository\Core\SharedModel\ContentRepository\ContentRepositoryStatus::$subscriptionStatus}. Further documentation in {\Neos\ContentRepository\Core\Subscription\SubscriptionStatusCollection}.
Subscriptions (mainly projections)
This maintainer offers also the public API to interact with the subscription catchup. In the happy path, no interaction is necessary, as {\Neos\ContentRepository\Core\ContentRepository::handle()} triggers the subscriptions after applying the events.
Special cases:
Replay for initialisation
For initialising on a new database - which contains events already - a replay will make sure that the subscriptions are emptied and reapply the events. This can be triggered via {\Neos\ContentRepository\Core\Service\replaySubscription} or {\Neos\ContentRepository\Core\Service\replayAllSubscriptions}
And after registering a new subscription a setup as well as a replay of this subscription is also required.
Replay to repair
In case a subscription is detached and then reinstalled a replay will make sure its caught up to all new events. And that the previous state will be reset as the projections logic might have changed.
Also in case a subscription runs into the error status, its code needs to be fixed, and it can be attempted to be replayed.
Constants
| private REPLAY_BATCH_SIZE |
|
Methods
No description
No description
No description
Reactivate a subscription
WARNING: Removes all events from the content repository and resets the subscriptions This operation cannot be undone.
Details
__construct(EventStoreInterface $eventStore, SubscriptionEngine $subscriptionEngine)
| internal | please use the {@see \Neos\ContentRepository\Core\Service\ContentRepositoryMaintainerFactory} instead! |
No description
Error|null
setUp()
No description
ContentRepositoryStatus
status()
No description
Error|null
replaySubscription(SubscriptionId $subscriptionId, Closure|null $progressCallback = null)
No description
Error|null
replayAllSubscriptions(Closure|null $progressCallback = null)
No description
Error|null
reactivateSubscription(SubscriptionId $subscriptionId, Closure|null $progressCallback = null)
| internal | reactivation is an experimental and advanced concept, if possible a replay should be used instead which is more stable Problematic can be events where the projection did partially apply them (some commited queries) but then suddenly crashed. A reactivation attempts to fully reapply that event which can conflict with work already done. |
Reactivate a subscription
The explicit catchup is only needed for subscriptions in the error or detached status with an advanced position. Running a full replay would work but might be overkill, instead this reactivation will just attempt catchup the subscription back to active from its current position.
Error|null
prune()
WARNING: Removes all events from the content repository and resets the subscriptions This operation cannot be undone.