/**
  * @param string $queueName
  * @return array|null
  */
 private function fetchRabbitQueueStatus($queueName)
 {
     try {
         return $this->client->queues()->get($this->vhost, $queueName);
     } catch (Guzzle\Http\Exception\ClientErrorResponseException $e) {
         if ($e->getResponse()->getStatusCode() === Nette\Http\IResponse::S404_NOT_FOUND) {
             throw new InvalidStateException(sprintf('Queue %s not found in vhost %s', $queueName, $this->vhost), 0, $e);
         }
         return NULL;
     }
 }
 /**
  * Clean rabbitmq
  *
  * @param Client $client
  */
 protected function cleanAll(Client $client)
 {
     $exchanges = $client->exchanges()->all();
     foreach ($exchanges as $exchange) {
         if ('' === $exchange['name'] || 0 === strpos($exchange['name'], 'amq')) {
             continue;
         }
         $client->exchanges()->delete($exchange['vhost'], $exchange['name']);
     }
     $queues = $client->queues()->all();
     foreach ($queues as $queue) {
         $client->queues()->delete($queue['vhost'], $queue['name']);
     }
     $connections = $client->connections()->all();
     foreach ($connections as $connection) {
         $client->connections()->delete($connection['name']);
     }
 }
<?php

use RabbitMq\ManagementApi\Client;
require_once __DIR__ . '/vendor/autoload.php';
$baseUrl = 'http://rabbitmq.integ8.lafourchette.io:15672';
$username = '******';
$password = '******';
$vhost = '/tmp_vhost';
$exchange = 'tmp_exchange';
$queueTemplate = 'queue.{modulus}';
$routingTemplate = 'message.1.{modulus}.#';
$nbShard = 10;
$client = new Client(null, $baseUrl, $username, $password);
$client->vhosts()->create($vhost);
$client->permissions()->create($vhost, $username, array("configure" => ".*", "write" => ".*", "read" => ".*"));
$client->exchanges()->create($vhost, $exchange, array('type' => 'topic'));
for ($i = 0; $i < $nbShard; $i++) {
    $queue = modulus($queueTemplate, $i);
    $client->queues()->create($vhost, $queue, array('type' => 'topic'));
    $client->bindings()->create($vhost, $exchange, $queue, modulus($routingTemplate, $i));
}
function modulus($template, $modulus)
{
    return strtr($template, array('{modulus}' => $modulus));
}