docs: rewrite JsonRpcBundle docs, add SDK docs, move them under docs/api
en/docs/api/json-rpc-bundle/functionality/events/async_output.md
new file +75
−0
rpc.async_output
Event name
rpc.async_output
Constant
RpcEvent::OUTPUT_ASYNC
Class
RpcAsyncOutputEvent
Properties
RpcRequest $rpcRequest, RpcBatchRequest $batchRequest, string $output
Dispatched in the parent batch process in process mode (batch.process: true) when the ufo:rpc:process child process has finished. $output is the raw process output (the response JSON).
Not dispatched in inline batch mode and for single requests.
Built-in listeners
| Priority | Listener | What it does |
|---|---|---|
| 10 | AsyncServerEventListener::process |
Parses $output into a response (empty or invalid output — error), adds it to the batch and always stops propagation |
What can be changed
- A listener with a priority above 10 can change
$event->outputbefore parsing. - Listeners with a priority of 10 and below are not called.
- Do not stop propagation above 10: the item will get no response and will most likely disappear from the batch result.
Usage examples
- diagnostics: logging the raw output of child processes to find the cause of "Asynchronous request does not respond";
- metrics of duration and response size of batch items.
#[AsEventListener(RpcEvent::OUTPUT_ASYNC, priority: 100)]
final class BatchOutputLogger
{
public function __construct(private LoggerInterface $logger) {}
public function __invoke(RpcAsyncOutputEvent $event): void
{
$this->logger->debug('batch item output', [
'method' => $event->rpcRequest->getMethod(),
'bytes' => strlen($event->output),
]);
}
}