Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/ingresse/message-queue-php
PHP Message Queue
https://github.com/ingresse/message-queue-php
backend
Last synced: about 2 months ago
JSON representation
PHP Message Queue
- Host: GitHub
- URL: https://github.com/ingresse/message-queue-php
- Owner: ingresse
- Created: 2016-03-07T20:48:03.000Z (almost 9 years ago)
- Default Branch: main
- Last Pushed: 2020-07-23T13:55:26.000Z (over 4 years ago)
- Last Synced: 2024-04-23T22:09:27.393Z (9 months ago)
- Topics: backend
- Language: PHP
- Homepage:
- Size: 38.1 KB
- Stars: 3
- Watchers: 27
- Forks: 1
- Open Issues: 2
-
Metadata Files:
- Readme: readme.md
Awesome Lists containing this project
README
##Message Queue php library to publish and subscribe to queues with diferent types of adapters.
##Current supported adapters:
- [RabbitMQ - AMQP 0.9.1](https://www.rabbitmq.com/tutorials/amqp-concepts.html)
##Installation
With Composer
Add ingresse/message-queue-php as dependency in composer.json```javascript
"require": {
...
"ingresse/message-queue-php" : "1.*"
...
}
```Run composer update.
Now the message-queue-php will be autoloaded into your project.
```php
require 'vendor/autoload.php';$configData = [
'connection' => [
'host' => 'localhost',
'port' => 5672,
'user' => 'guest',
'pass' => 'guest',
'vhost' => '/'
],
'queues' => [
'worker.test' => [
'passive' => false,
'durable' => true,
'exclusive' => false,
'autoDelete' => false,
'delivery_mode' => 2
]
],
'exchanges' => [
'exchange.test' => [
'type' => 'fanout'
'passive' => false,
'durable' => true,
'auto_delete' => false,
'internal' => false,
'nowait' => false,
'arguments' => false,
'ticket' => false,
'delivery_mode' => 2
]
],
'consume' => [
'Simpler' => [
'noLocal' => false,
'noAck' => false,
'exclusive' => false,
'noWait' => false
]
],
'logger' => [
'host' => 'localhost',
'port' => 6379,
'key' => 'logstash',
'channel' => 'message-queue-php'
path' => '/var/log/message-queue-php.log'
]
];$config = new MessageQueuePHP\Config\AMQPConfig($configData);
$amqpAdapter = new MessageQueuePHP\Adapter\AMQPAdapter($config);$myPublisher = new MessageQueuePHP\Publisher\Publisher($amqpAdapter, 'worker.test');
$myPublisher
->setMessage($myData)
->send();$subscriber = new MessageQueuePHP\Subscriber\Subscriber($amqpAdapter);
$simplerConsumer = new MessageQueuePHP\Subscriber\Consumer\SimplerConsumer;
$subscriber
->setConsumer($simplerConsumer)
->subscribe('worker.test')
->consume();
```