public function getQueueByWeight()
    {
        $weights = array_map(function(QueueInterface $queue) {
            return $queue->getWeight();
        }, $this->getQueues());

        $rand = mt_rand(1, array_sum($weights));

        /** @var Queue $queue */
        foreach ($this->getQueues() as $queue) {
            $rand -= $queue->getWeight();
            if ($rand <= 0) {
                $this->logDebug('Queue "'. strtoupper($queue->getName()) .'" selected by weight.');
                return $queue;
            }
        }
    }