enqueue-dev
enqueue-dev copied to clipboard
non-static QueueSubscriberInterface::getSubscribedQueues()
I propose to make this accessor non-static to allow developers build more flexible mechanism of subscription. For example I have code:
abstract class AbstractConsumer implements Processor, QueueSubscriberInterface
{
// ....
// ....
public function process(Message $message, Context $context)
{
$event = $this->serializer->deserialize($message->getBody(), $this->eventModel(), $this->format());
try {
$this->doProcessEvent($event);
} catch (OperationNotSupportedException $e) {
return self::REJECT;
} catch (OperationFailedException $e) {
return self::REQUEUE;
}
return self::ACK;
}
abstract protected function eventModel(): string;
abstract protected function doProcessEvent(EventInterface $event): void;
// FYI getSubscribedQueues() is implemented by child classes
}
where getSubscribedQueues()
is implemented by child classes.
In my project I want to introduce EventProcessorInterface
, which can process events data mapped to eventModel()
considering getSubscribedEvents(): string[]
. But I cannot INJECT EventProcessorInterface
to AbstractConsumer
and delegate QueueSubscriberInterface::getSubscribedQueues()
to EventProcessorInterface::getSubscribedEvents()
because it is static method!
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.