oktopost / deep-queue
Messaging library
Installs: 248
Dependents: 1
Suggesters: 0
Security: 0
Stars: 0
Watchers: 12
Forks: 0
Open Issues: 0
Type:lib
Requires
- oktopost/annotation: ^1.0
- oktopost/cosmic-ray: ^1.0
- oktopost/objection: ^1.0
- oktopost/serialization: ^1.0
- oktopost/skeleton: ^1.1
- oktopost/squid: ^1.0.24
- php-on-couch/php-on-couch: ^2.0
- predis/predis: ^1.1
- unstable-cacao/traitor: ^1.0
Requires (Dev)
- phpunit/phpunit: ^6.1
- satooshi/php-coveralls: ^1.0
README
DeepQueue
DeepQueue is a messaging library
Installation
composer require oktopost/deep-queue
or inside composer.json
"require": { "oktopost/deep-queue": "^1.0" }
Usage example
Basic configuration
$deepQueue = new DeepQueue(); $deepQueue->config() ->setConnectorPlugin(Connectors::Redis(['prefix' => 'demo.queue'])) ->setManagerPlugin(Managers::MySQL(['user' => 'root', 'db' => 'demo_queue'])) ->setSerializer(DefaultSerializer::get()) ->addLogProvider(new FileLogProvider(__DIR__)); //or using prepared configuration $deepQueue = PreparedQueue::RedisMySQL(['prefix' => 'demo.queue'], ['user' => 'root', 'db' => 'demo_queue']); $deepQueue->config() ->addLogProvider(new FileLogProvider(__DIR__));
Working with queue object configuration
//creating and setting up new queue object $queueObject = new QueueObject(); $queueObject->Name = 'demo.queue'; $queueObject->Config = new QueueConfig(); $queueObject->Config->DelayPolicy = Policy::ALLOWED; $deepQueue->config() ->manager() ->create($queueObject); //loading existing queue object $queueObject = $deepQueue->getQueueObject('demo.queue');
Working with queue connector
//get connector $queue = $deepQueue->get('demo.queue'); //enqueue data $payload = new Payload('payload data'); $queue->enqueue($payload); //or $payload = new Payload('payload data'); $payload2 = new Payload('payload data2'); $queue->enqueueAll([$payload, $payload2]); //dequeue data $payloads = $queue->dequeue(255);