jaddek / amqp-client
This package is abandoned and no longer maintained.
No replacement package was suggested.
AMQP Client
v0.1.5
2016-12-26 09:16 UTC
Requires
- php: >=5.4.0
- php-amqplib/php-amqplib: ~2.6
This package is not auto-updated.
Last update: 2017-09-04 00:02:23 UTC
README
Обертка над videlalvaro/php-amqplib
Примеры
$config = [ 'exchange' => [ 'name' => 'test.alert', 'params' => [ 'type' => \Jaddek\AMQPClient\AMQPClient::AMQP_EX_TYPE_DIRECT, 'passive' => false, 'durable' => true, 'auto_delete' => false, ], ], 'queue' => [ 'name' => 'test.alert', 'params' => [ 'passive' => false, 'durable' => true, 'exclusive' => false, 'auto_delete' => false, ], ], 'channelId' => null, 'bindParams' => [], 'queueParams' => [], 'publishParams' => [], 'consumeParams' => [ 'consumer_tag' => 'test', 'no_local' => false, 'no_ack' => false, 'exclusive' => false, 'nowait' => false, 'callback' => 'ack', ], ]; $exchange = $config['exchange']; $queue = $config['queue']; /** * Consumer callback */ function ack(\PhpAmqpLib\Message\AMQPMessage $msg) { echo "\n--------\n"; echo $msg->body; echo "\n--------\n"; \Jaddek\AMQPClient\Foundation\Basic::ack($msg); } $client = new Jaddek\AMQPClient\AMQPClient(); /** * обертка над message */ $message = \Jaddek\AMQPClient\Foundation\Message::instance(['test' => 9]); $client->direct($exchange['name'], $queue['name'], $exchange['params'], $queue['params']) ->send($message, $exchange['name']) ->close(); $consumer = new Jaddek\AMQPClient\AMQPClient(); $consumer->direct($exchange['name'], $queue['name'], $exchange['params'], $queue['params']) ->consume($queue['name'], $config['consumeParams']) ;