Exemple #1
0
<?php

include_once 'vendor/autoload.php';
$c = new Bunny\Client(['host' => '127.0.0.1', 'port' => 5672, 'vhost' => '/', 'user' => 'guest', 'password' => 'guest']);
$c->connect();
$ch = $c->channel();
$ch->queueDeclare('thumbGenerationQ');
$ch->exchangeDeclare("thumbGenerationE");
$ch->queueBind("thumbGenerationQ", "thumbGenerationE");
$body = ['source' => '/root/conv/Performance_Out.pptx', 'target' => '/var/www/thumbs/4/5/458.png'];
$ch->publish(json_encode($body), [], "thumbGenerationE");
$c->disconnect();
Exemple #2
0
<?php

require_once __DIR__ . '/../vendor/autoload.php';
$connection = new \Bunny\Client(['host' => '192.168.33.99']);
$channel = $connection->connect()->channel();
$channel->queueDeclare('bunny_queue');
$channel->exchangeDeclare('bunny_exchange');
$channel->queueBind('bunny_queue', 'bunny_exchange');
$channel->run(function (\Bunny\Message $msg, \Bunny\Channel $ch, \Bunny\Client $c) {
    echo $msg->content . "\n";
    $ch->ack($msg);
}, 'bunny_queue', 'consumer_tag');
$connection->disconnect();