final class DelegatingCatchUpHook implements CatchUpHookInterface (View source)

internal  
 

Internal helper class for running multiple CatchUpHooks inside a Projection update cycle.

Methods

__construct(PerformanceTracerInterface|null $performanceTracer, CatchUpHookInterface ...$catchUpHooks)

No description

void
onBeforeCatchUp(SubscriptionStatus $subscriptionStatus)

This hook is called at the beginning of a catch-up run, after the database lock is acquired, but before any projection was called.

void
onBeforeEvent(EventInterface $eventInstance, EventEnvelope $eventEnvelope)

This hook is called for every event during the catchup process, before the projection is updated but in the same transaction.

void
onAfterEvent(EventInterface $eventInstance, EventEnvelope $eventEnvelope)

This hook is called for every event during the catchup process, after the projection is updated but in the same transaction,

void
onAfterBatchCompleted()

This hook is called for each batch of processed events during the catchup process, after the projection and their new position is updated and the transaction is commited.

void
onAfterCatchUp()

This hook is called at the END of a catch-up run, after the projection and their new position is updated and the transaction is commited.

Details

__construct(PerformanceTracerInterface|null $performanceTracer, CatchUpHookInterface ...$catchUpHooks)

No description

Parameters

PerformanceTracerInterface|null $performanceTracer
CatchUpHookInterface ...$catchUpHooks

void onBeforeCatchUp(SubscriptionStatus $subscriptionStatus)

This hook is called at the beginning of a catch-up run, after the database lock is acquired, but before any projection was called.

Note that any errors thrown will be collected and the current catchup batch will be finished as normal. The collect errors will be returned and rethrown by the content repository.

Parameters

SubscriptionStatus $subscriptionStatus

Return Value

void

Exceptions

CatchUpHookFailed

void onBeforeEvent(EventInterface $eventInstance, EventEnvelope $eventEnvelope)

This hook is called for every event during the catchup process, before the projection is updated but in the same transaction.

Note that any errors thrown will be collected and the current catchup batch will be finished as normal. The collect errors will be returned and rethrown by the content repository.

Parameters

EventInterface $eventInstance
EventEnvelope $eventEnvelope

Return Value

void

Exceptions

CatchUpHookFailed

void onAfterEvent(EventInterface $eventInstance, EventEnvelope $eventEnvelope)

This hook is called for every event during the catchup process, after the projection is updated but in the same transaction,

Note that any errors thrown will be collected and the current catchup batch will be finished as normal. The collect errors will be returned and rethrown by the content repository.

Parameters

EventInterface $eventInstance
EventEnvelope $eventEnvelope

Return Value

void

Exceptions

CatchUpHookFailed

void onAfterBatchCompleted()

This hook is called for each batch of processed events during the catchup process, after the projection and their new position is updated and the transaction is commited.

The database lock is directly acquired again after it is released if the batching needs to continue. It can happen that this method is called even without having seen events in the meantime.

Note that any errors thrown will be collected but no further batch is started. The collect errors will be returned and rethrown by the content repository.

Return Value

void

Exceptions

CatchUpHookFailed

void onAfterCatchUp()

This hook is called at the END of a catch-up run, after the projection and their new position is updated and the transaction is commited.

Note that any errors thrown will be collected and the catchup will finish as normal. The collect errors will be returned and rethrown by the content repository.

Return Value

void

Exceptions

CatchUpHookFailed