Skip to content

Latest commit

 

History

History
46 lines (25 loc) · 1.4 KB

File metadata and controls

46 lines (25 loc) · 1.4 KB

Dispatch

Model

Dispatch is synchronous. SynchronousEventDispatcher retrieves matching listeners from OrderedListenerProvider and invokes them immediately in the current call stack.

There is no queue, retry layer, transport abstraction, or deferred execution path.

Listener Matching

Listeners are matched by PHP type checks:

  • a listener for a concrete event class receives that event class
  • a listener for a parent type or family interface also matches compatible events

This allows listeners to target either a specific event or a broader event family.

Related:

Priority And Order

Execution order is deterministic:

  • higher priority runs first
  • listeners with the same priority run in registration order

OrderedListenerProvider preserves a sequence number for each registration so ties remain stable.

Subscribers

Subscribers are flattened into normal listener registrations. Their subscriptions are added to the same ordered listener list and participate in the same priority and sequence rules.

Propagation Rules

Propagation stopping is optional. If an event implements StoppableEventInterface, the dispatcher checks isPropagationStopped():

  • before invoking each listener
  • after invoking each listener

Once propagation is stopped, no remaining listeners are executed.

Related: