DoctrineCloseConnectionMiddleware implements MiddlewareInterface

Read onlyYes
FinalYes

Closes the open database connections after a worker handled a received message, so the next message starts with a fresh connection in long-running "messenger:consume" workers.

Only messages consumed asynchronously by a worker (carrying a ConsumedByWorkerStamp) are handled; a synchronous dispatch never touches connections. Embedded SQLite connections are skipped (closing them is pointless and, for an in-memory database, would discard all data). Connections are closed even when handling throws, and individual connections can be excluded via BeforeMessengerDoctrineCloseEvent.

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) : mixed
Parameters
$connectionPool : ConnectionPool
$eventDispatcher : EventDispatcherInterface

handle()

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

Search results