takatost / php-pubsub-cmq
A Tencent CMQ adapter for the php-pubsub package.
1.0.1
2017-03-23 03:26 UTC
Requires
- php: >=5.6.0
- guzzlehttp/guzzle: ^6.2
- illuminate/support: >=5.2
- superbalist/php-pubsub: ^1.0
Requires (Dev)
- mockery/mockery: ^0.9.5
- phpunit/phpunit: ^5.5
This package is not auto-updated.
Last update: 2024-10-26 20:37:50 UTC
README
A Tencent CMQ adapter for the php-pubsub package.
Installation
composer require takatost/php-pubsub-cmq
Usage
$config = [ 'secret_key' => '', 'secret_id' => '', 'queue_end_point' => 'https://cmq-queue-sh.api.qcloud.com/v2/index.php', 'topic_end_point' => 'https://cmq-topic-sh.api.qcloud.com/v2/index.php', 'options' => [ 'debug' => false, 'timeout' => 10, ] ]; $adapter = new \Takatost\PubSub\CMQ\CMQPubSubAdapter($config); // consume messages // note: this is a blocking call $adapter->subscribe('topic_queue_name', function ($message) { var_dump($message); }); // publish messages $adapter->publish('topic_name', 'HELLO WORLD'); $adapter->publish('topic_name', json_encode(['hello' => 'world'])); $adapter->publish('topic_name', 1); $adapter->publish('topic_name', false);