Dispatches a CleverAge\ProcessBundle\Event\EventDispatcherTaskEvent through the Symfony event dispatcher. The event
gives listeners access to the current ProcessState (getState()), so they can read the input and, when the task is
not passive, set the output themselves.
- Service:
CleverAge\ProcessBundle\Task\Event\EventDispatcherTask - Code:
event_dispatcher(task: event_dispatcher)
any
any: the input, unchanged, whenpassiveistrue- when
passiveisfalse: whatever a listener set with$event->getState()->setOutput(),nullotherwise
| Code | Type | Required | Default | Description |
|---|---|---|---|---|
event_name |
string|null |
null |
Name of the dispatched event, null to use the event class name (see Notes) |
|
passive |
bool |
true |
If true, the input is passed to the output before dispatch |
- Dispatch an event for each item
# Task configuration level
data:
task: constant_iterable_output
options:
output: [1, 2, 3]
outputs: [push_data_event]
push_data_event:
task: event_dispatcher
options:
event_name: myapp.data_queueThe event is dispatched with $eventDispatcher->dispatch($event, $eventName):
- when
event_nameis set, listeners must subscribe to that name:
#[AsEventListener(event: 'myapp.data_queue')]
public function onDataQueue(EventDispatcherTaskEvent $event): void
{
$input = $event->getState()->getInput();
}- when
event_nameisnull, the event name is the event class name, so listeners must subscribe toCleverAge\ProcessBundle\Event\EventDispatcherTaskEvent. EveryEventDispatcherTaskwithoutevent_namethen triggers the same listeners.
Deprecated since v5, removed in v6.0: from v4.0 to v5.0, the event_name option was ignored and the event was
always dispatched under its class name. To preserve backward compatibility, when event_name is set (and differs from the
event class name) and listeners subscribe to CleverAge\ProcessBundle\Event\EventDispatcherTaskEvent, the event is also
dispatched under its class name and an E_USER_DEPRECATED error is triggered. In v6.0, listen to the configured
event_name instead, or remove the event_name option.