alchemy / queue-component
Message queue component
Installs: 56 086
Dependents: 2
Suggesters: 0
Security: 0
Stars: 1
Watchers: 6
Forks: 1
Open Issues: 1
Requires
- php: >=5.5
- psr/log: ^1.0
- ramsey/uuid: ^3.3
Requires (Dev)
- empi89/php-amqp-stubs: dev-master
- mikey179/vfsstream: ^1.6
- phpunit/phpunit: ^4.0|^5.0
Suggests
- ext-amqp: To use the AMQP extension adapters
This package is not auto-updated.
Last update: 2024-10-28 23:41:24 UTC
README
alchemy/queue-component is a library providing a minimalist publish/subscribe abstraction over AMQP
Installation
The only supported installation method is via Composer. Run the following command to require the package in your project:
composer require alchemy/queue-component
Quickstart guide
// Note: the following array contains all available parameters and their default values // Every configuration key is optional, and its default value used when not defined in parameters $parameters = [ 'host' => 'localhost', 'vhost' => '/', 'port' => 5672, 'user' => 'guest', 'password' => 'guest', 'exchange' => 'alchemy-exchange', 'dead-letter-exchange' => 'alchemy-dead-exchange', 'queue' => 'alchemy-queue' ]; $factory = Alchemy\Queue\Amqp\AmqpMessageQueueFactory::create($parameters); // Publish a message $factory->getNamedQueue('my-queue')->publish(new Message('message body', 'correlation-id')); // Consume next message in queue $handler = new Alchemy\Queue\NullMessageHandler(); $resolver = new Alchemy\Queue\MessageHandlerResolver($handler); $factory->getNamedQueue('my-queue')->handle($resolver);