mirror of
https://github.com/alchemy-fr/Phraseanet.git
synced 2025-10-17 23:13:15 +00:00
PHRAS-1251 Replace webhook job by queue worker
This commit is contained in:
@@ -9,13 +9,14 @@ use Alchemy\Phrasea\Webhook\Processor\CallableProcessorFactory;
|
||||
use Alchemy\Phrasea\Webhook\Processor\FeedEntryProcessorFactory;
|
||||
use Alchemy\Phrasea\Webhook\Processor\OrderNotificationProcessorFactory;
|
||||
use Alchemy\Phrasea\Webhook\Processor\ProcessorFactory;
|
||||
use Alchemy\Phrasea\Webhook\Processor\ProcessorInterface;
|
||||
use Alchemy\Phrasea\Webhook\Processor\UserRegistrationProcessorFactory;
|
||||
|
||||
class EventProcessorFactory
|
||||
{
|
||||
|
||||
/**
|
||||
* @var ProcessorFactory
|
||||
* @var ProcessorFactory[]
|
||||
*/
|
||||
private $processorFactories = [];
|
||||
|
||||
@@ -57,10 +58,20 @@ class EventProcessorFactory
|
||||
/**
|
||||
* @param WebhookEvent $event
|
||||
* @return Processor\ProcessorInterface
|
||||
* @deprecated Use getProcessor() instead
|
||||
*/
|
||||
public function get(WebhookEvent $event)
|
||||
{
|
||||
if (! isset($this->processorFactories[$event->getType()])) {
|
||||
return $this->getProcessor($event);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param WebhookEvent $event
|
||||
* @return ProcessorInterface
|
||||
*/
|
||||
public function getProcessor(WebhookEvent $event)
|
||||
{
|
||||
if (!isset($this->processorFactories[$event->getType()])) {
|
||||
throw new \RuntimeException(sprintf('No processor found for %s', $event->getType()));
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user