$this->
executeStatement(sprintf('LISTEN "%s"',
$this->configuration
['table_name'
]));
if (method_exists($this->driverConnection, 'getNativeConnection'
)) { $wrappedConnection =
$this->driverConnection->
getNativeConnection();
} else { $wrappedConnection =
$this->driverConnection;
while (method_exists($wrappedConnection, 'getWrappedConnection'
)) { $wrappedConnection =
$wrappedConnection->
getWrappedConnection();
} } $notification =
$wrappedConnection->
pgsqlGetNotify(\PDO::FETCH_ASSOC,
$this->configuration
['get_notify_timeout'
]);
if ( // no notifications, or for another table or queue
(false ===
$notification ||
$notification['message'
] !==
$this->configuration
['table_name'
] ||
$notification['payload'
] !==
$this->configuration
['queue_name'
]) // delayed messages
&& (microtime(true
) * 1000 -
$this->queueEmptiedAt <
$this->configuration
['check_delayed_interval'
]) ) { usleep(1000
);
return null;
}