diff --git a/src/RabbitMQ.php b/src/RabbitMQ.php index f3607f4..75add93 100644 --- a/src/RabbitMQ.php +++ b/src/RabbitMQ.php @@ -29,6 +29,9 @@ static public function createVhosts() foreach (self::$vhosts as $vhost) { $vhost = str_replace('/', '%2f', $vhost); + // delete the vhost if it exists. See the comment bellow in deleteVhosts() + $client->delete("/api/vhosts/{$vhost}", [ 'http_errors' => false ]); + $client->put("/api/vhosts/{$vhost}"); $client->put(