private function iterate(string $queueName, int $time = null)
{
$received = $this->implementation->getQueueDriver()->awaitCommand($queueName, $time);
$command = $this->implementation->getCommandSerializer()->unserialize($received->getSerialized());
$this->implementation->getLogger()->debug('Command received', compact('command'));
try {
$this->implementation->getCommandBusAdapter()->handle($command, true);
$this->implementation->getLogger()->info('Command handled', compact('command'));
} catch (\Throwable $exception) {
$this->implementation->getLogger()->error('Command failed', compact('command', 'exception'));
} finally {
$this->implementation->getQueueDriver()->completeCommand($received->getQueueName(), $received->getId());
}
}