DoctrinePingConnectionMiddleware implements MiddlewareInterface

Read onlyYes
FinalYes

Pings the open database connections - and transparently reconnects stale ones - before a worker handles a received message. This avoids "server has gone away" failures in long-running "messenger:consume" workers whose connection went idle between messages.

Only messages consumed asynchronously by a worker (carrying a ConsumedByWorkerStamp) are handled; a synchronous dispatch never touches connections. Embedded SQLite connections are skipped (they are not server-based and cannot go stale), and individual connections can be excluded via BeforeMessengerDoctrinePingEvent.

Internal

not part of TYPO3 Core API

Table of Contents

Interfaces

MiddlewareInterface

Methods

__construct()  : mixed
handle()  : Envelope

Methods

__construct()

public __construct(ConnectionPool $connectionPool, EventDispatcherInterface $eventDispatcher, LoggerInterface $logger) : mixed
Parameters
$connectionPool : ConnectionPool
$eventDispatcher : EventDispatcherInterface
$logger : LoggerInterface

handle()

public handle(Envelope $envelope, StackInterface $stack) : Envelope
Parameters
$envelope : Envelope
$stack : StackInterface
Return values
Envelope
On this page

Search results