diff options
author | Paulino Michelazzo <paulino@michelazzo.com.br> | 2016-10-18 22:48:23 +0200 |
---|---|---|
committer | Paulino Michelazzo <paulino@michelazzo.com.br> | 2016-10-18 22:48:23 +0200 |
commit | 99731f0bb1f6fd2815eeb9af504ce86df927657b (patch) | |
tree | b080efc608d2bbd52b77a4a0067402007f50c5a8 /src/Wallabag/ImportBundle/Redis | |
parent | 3a3c6b866b52721431bed22426d9abfcd0d2dfe0 (diff) | |
parent | 7180aaed45dce62e40620a9e4b202526ebd6a3bb (diff) | |
download | wallabag-99731f0bb1f6fd2815eeb9af504ce86df927657b.tar.gz wallabag-99731f0bb1f6fd2815eeb9af504ce86df927657b.tar.zst wallabag-99731f0bb1f6fd2815eeb9af504ce86df927657b.zip |
Merge remote-tracking branch 'wallabag/master'
Diffstat (limited to 'src/Wallabag/ImportBundle/Redis')
-rw-r--r-- | src/Wallabag/ImportBundle/Redis/Producer.php | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/src/Wallabag/ImportBundle/Redis/Producer.php b/src/Wallabag/ImportBundle/Redis/Producer.php new file mode 100644 index 00000000..fedc3e57 --- /dev/null +++ b/src/Wallabag/ImportBundle/Redis/Producer.php | |||
@@ -0,0 +1,36 @@ | |||
1 | <?php | ||
2 | |||
3 | namespace Wallabag\ImportBundle\Redis; | ||
4 | |||
5 | use OldSound\RabbitMqBundle\RabbitMq\ProducerInterface; | ||
6 | use Simpleue\Queue\RedisQueue; | ||
7 | |||
8 | /** | ||
9 | * This is a proxy class for "Simpleue\Queue\RedisQueue". | ||
10 | * It allow us to use the same way to publish a message between RabbitMQ & Redis: publish(). | ||
11 | * | ||
12 | * It implements the ProducerInterface of RabbitMQ (yes it's ugly) so we can have the same | ||
13 | * kind of class which implements the same interface. | ||
14 | * So we can inject either a RabbitMQ producer or a Redis producer with the same signature | ||
15 | */ | ||
16 | class Producer implements ProducerInterface | ||
17 | { | ||
18 | private $queue; | ||
19 | |||
20 | public function __construct(RedisQueue $queue) | ||
21 | { | ||
22 | $this->queue = $queue; | ||
23 | } | ||
24 | |||
25 | /** | ||
26 | * Publish a message in the Redis queue. | ||
27 | * | ||
28 | * @param string $msgBody | ||
29 | * @param string $routingKey NOT USED | ||
30 | * @param array $additionalProperties NOT USED | ||
31 | */ | ||
32 | public function publish($msgBody, $routingKey = '', $additionalProperties = array()) | ||
33 | { | ||
34 | $this->queue->sendJob($msgBody); | ||
35 | } | ||
36 | } | ||