mirror of
https://github.com/wallabag/wallabag.git
synced 2025-08-26 18:21:02 +00:00
Move source files directly under src/ directory
This commit is contained in:
parent
804261bc26
commit
a37b385c23
190 changed files with 19 additions and 21 deletions
36
src/Redis/Producer.php
Normal file
36
src/Redis/Producer.php
Normal file
|
@ -0,0 +1,36 @@
|
|||
<?php
|
||||
|
||||
namespace Wallabag\CoreBundle\Redis;
|
||||
|
||||
use OldSound\RabbitMqBundle\RabbitMq\ProducerInterface;
|
||||
use Simpleue\Queue\RedisQueue;
|
||||
|
||||
/**
|
||||
* This is a proxy class for "Simpleue\Queue\RedisQueue".
|
||||
* It allow us to use the same way to publish a message between RabbitMQ & Redis: publish().
|
||||
*
|
||||
* It implements the ProducerInterface of RabbitMQ (yes it's ugly) so we can have the same
|
||||
* kind of class which implements the same interface.
|
||||
* So we can inject either a RabbitMQ producer or a Redis producer with the same signature
|
||||
*/
|
||||
class Producer implements ProducerInterface
|
||||
{
|
||||
private $queue;
|
||||
|
||||
public function __construct(RedisQueue $queue)
|
||||
{
|
||||
$this->queue = $queue;
|
||||
}
|
||||
|
||||
/**
|
||||
* Publish a message in the Redis queue.
|
||||
*
|
||||
* @param string $msgBody
|
||||
* @param string $routingKey NOT USED
|
||||
* @param array $additionalProperties NOT USED
|
||||
*/
|
||||
public function publish($msgBody, $routingKey = '', $additionalProperties = [])
|
||||
{
|
||||
$this->queue->sendJob($msgBody);
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue