forked from wallabag/wallabag
Move Import redis to Core
This commit is contained in:
@ -8,7 +8,7 @@ use Symfony\Component\HttpFoundation\Request;
|
||||
use Symfony\Component\Routing\Annotation\Route;
|
||||
use Symfony\Contracts\Translation\TranslatorInterface;
|
||||
use Wallabag\CoreBundle\Import\ChromeImport;
|
||||
use Wallabag\ImportBundle\Redis\Producer as RedisProducer;
|
||||
use Wallabag\CoreBundle\Redis\Producer as RedisProducer;
|
||||
|
||||
class ChromeController extends BrowserController
|
||||
{
|
||||
|
||||
@ -10,7 +10,7 @@ use Symfony\Contracts\Translation\TranslatorInterface;
|
||||
use Wallabag\CoreBundle\Controller\AbstractController;
|
||||
use Wallabag\CoreBundle\Form\Type\UploadImportType;
|
||||
use Wallabag\CoreBundle\Import\DeliciousImport;
|
||||
use Wallabag\ImportBundle\Redis\Producer as RedisProducer;
|
||||
use Wallabag\CoreBundle\Redis\Producer as RedisProducer;
|
||||
|
||||
class DeliciousController extends AbstractController
|
||||
{
|
||||
|
||||
@ -8,7 +8,7 @@ use Symfony\Component\HttpFoundation\Request;
|
||||
use Symfony\Component\Routing\Annotation\Route;
|
||||
use Symfony\Contracts\Translation\TranslatorInterface;
|
||||
use Wallabag\CoreBundle\Import\ElcuratorImport;
|
||||
use Wallabag\ImportBundle\Redis\Producer as RedisProducer;
|
||||
use Wallabag\CoreBundle\Redis\Producer as RedisProducer;
|
||||
|
||||
class ElcuratorController extends WallabagController
|
||||
{
|
||||
|
||||
@ -8,7 +8,7 @@ use Symfony\Component\HttpFoundation\Request;
|
||||
use Symfony\Component\Routing\Annotation\Route;
|
||||
use Symfony\Contracts\Translation\TranslatorInterface;
|
||||
use Wallabag\CoreBundle\Import\FirefoxImport;
|
||||
use Wallabag\ImportBundle\Redis\Producer as RedisProducer;
|
||||
use Wallabag\CoreBundle\Redis\Producer as RedisProducer;
|
||||
|
||||
class FirefoxController extends BrowserController
|
||||
{
|
||||
|
||||
@ -10,7 +10,7 @@ use Symfony\Contracts\Translation\TranslatorInterface;
|
||||
use Wallabag\CoreBundle\Controller\AbstractController;
|
||||
use Wallabag\CoreBundle\Form\Type\UploadImportType;
|
||||
use Wallabag\CoreBundle\Import\InstapaperImport;
|
||||
use Wallabag\ImportBundle\Redis\Producer as RedisProducer;
|
||||
use Wallabag\CoreBundle\Redis\Producer as RedisProducer;
|
||||
|
||||
class InstapaperController extends AbstractController
|
||||
{
|
||||
|
||||
@ -10,7 +10,7 @@ use Symfony\Contracts\Translation\TranslatorInterface;
|
||||
use Wallabag\CoreBundle\Controller\AbstractController;
|
||||
use Wallabag\CoreBundle\Form\Type\UploadImportType;
|
||||
use Wallabag\CoreBundle\Import\PinboardImport;
|
||||
use Wallabag\ImportBundle\Redis\Producer as RedisProducer;
|
||||
use Wallabag\CoreBundle\Redis\Producer as RedisProducer;
|
||||
|
||||
class PinboardController extends AbstractController
|
||||
{
|
||||
|
||||
@ -12,7 +12,7 @@ use Symfony\Component\Routing\Generator\UrlGeneratorInterface;
|
||||
use Symfony\Contracts\Translation\TranslatorInterface;
|
||||
use Wallabag\CoreBundle\Controller\AbstractController;
|
||||
use Wallabag\CoreBundle\Import\PocketImport;
|
||||
use Wallabag\ImportBundle\Redis\Producer as RedisProducer;
|
||||
use Wallabag\CoreBundle\Redis\Producer as RedisProducer;
|
||||
|
||||
class PocketController extends AbstractController
|
||||
{
|
||||
|
||||
@ -8,7 +8,7 @@ use Symfony\Component\HttpFoundation\Request;
|
||||
use Symfony\Component\Routing\Annotation\Route;
|
||||
use Symfony\Contracts\Translation\TranslatorInterface;
|
||||
use Wallabag\CoreBundle\Import\PocketHtmlImport;
|
||||
use Wallabag\ImportBundle\Redis\Producer as RedisProducer;
|
||||
use Wallabag\CoreBundle\Redis\Producer as RedisProducer;
|
||||
|
||||
class PocketHtmlController extends HtmlController
|
||||
{
|
||||
|
||||
@ -10,7 +10,7 @@ use Symfony\Contracts\Translation\TranslatorInterface;
|
||||
use Wallabag\CoreBundle\Controller\AbstractController;
|
||||
use Wallabag\CoreBundle\Form\Type\UploadImportType;
|
||||
use Wallabag\CoreBundle\Import\ReadabilityImport;
|
||||
use Wallabag\ImportBundle\Redis\Producer as RedisProducer;
|
||||
use Wallabag\CoreBundle\Redis\Producer as RedisProducer;
|
||||
|
||||
class ReadabilityController extends AbstractController
|
||||
{
|
||||
|
||||
@ -8,7 +8,7 @@ use Symfony\Component\HttpFoundation\Request;
|
||||
use Symfony\Component\Routing\Annotation\Route;
|
||||
use Symfony\Contracts\Translation\TranslatorInterface;
|
||||
use Wallabag\CoreBundle\Import\ShaarliImport;
|
||||
use Wallabag\ImportBundle\Redis\Producer as RedisProducer;
|
||||
use Wallabag\CoreBundle\Redis\Producer as RedisProducer;
|
||||
|
||||
class ShaarliController extends HtmlController
|
||||
{
|
||||
|
||||
@ -8,7 +8,7 @@ use Symfony\Component\HttpFoundation\Request;
|
||||
use Symfony\Component\Routing\Annotation\Route;
|
||||
use Symfony\Contracts\Translation\TranslatorInterface;
|
||||
use Wallabag\CoreBundle\Import\WallabagV1Import;
|
||||
use Wallabag\ImportBundle\Redis\Producer as RedisProducer;
|
||||
use Wallabag\CoreBundle\Redis\Producer as RedisProducer;
|
||||
|
||||
class WallabagV1Controller extends WallabagController
|
||||
{
|
||||
|
||||
@ -8,7 +8,7 @@ use Symfony\Component\HttpFoundation\Request;
|
||||
use Symfony\Component\Routing\Annotation\Route;
|
||||
use Symfony\Contracts\Translation\TranslatorInterface;
|
||||
use Wallabag\CoreBundle\Import\WallabagV2Import;
|
||||
use Wallabag\ImportBundle\Redis\Producer as RedisProducer;
|
||||
use Wallabag\CoreBundle\Redis\Producer as RedisProducer;
|
||||
|
||||
class WallabagV2Controller extends WallabagController
|
||||
{
|
||||
|
||||
36
src/Wallabag/CoreBundle/Redis/Producer.php
Normal file
36
src/Wallabag/CoreBundle/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);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user