snailweb / kubemq
PHP Client for KubeMQ
1.0.1
2020-03-11 16:07 UTC
This package is auto-updated.
Last update: 2025-06-12 03:57:14 UTC
README
PHP Client for KubeMQ using REST API
Installation
composer require snailweb/kubemq
Requirements
- PHP 7.1+
- CURL
Features
- Queue
peak- send
sendBatch- receive
ackAllMessages
Pub/SubRPC
Queue
Send a message
$queue = new \Snailweb\KubeMQ\Queue('kubemq-host', 9090, 'ClientA', 'Channel'); $message = new \Snailweb\KubeMQ\Message( 'metadata', // metadata (could be anything: int, string, array, object ...) ['field1' => 4, 'field2' => 'info'] // body (could be anything: int, string, array, object ...) ); // Optional settings here $message->setExpirationSeconds(5) ->setDelaySeconds(5) ->setMaxReceiveCount(10) ->setMaxReceiveQueue('queue-name'); try { $queue->send($message); } catch(Exception $exception) { var_dump($exception); }
Receive a message
$queue = new \Snailweb\KubeMQ\Queue('kubemq-host', 9090, 'ClientB', 'Channel', 32, // optional default max receive msg for this client 1); // optional default waiting time for this client try { $messages = $queue->receive(32, 1); // optional: we can override defaults of this client if(!empty($messages)) { var_dump($messages); } else { echo "no messages\n"; } } catch(Exception $exception) { var_dump($exception); }