protected function dispatchPendingEvents(ConnectionInterface $connection)
    {
        $connectionId = $connection->getName();
        $consumingEvents = $this->pendingEvents[$connectionId];

        unset($this->pendingEvents[$connectionId]);

        foreach ($consumingEvents as $transactionsEvents) {
            foreach ($transactionsEvents as $transactionEvents) {
                foreach ($transactionEvents as $event) {
                    $this->dispatcher->dispatch($event['event'], $event['payload']);
                }
            }
        }
    }