| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
Sorry, something went wrong.
I propose to make this accessor non-static to allow developers build more sophisticated mechanism of subscription. For example I have code:
```php
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. |
Sorry, something went wrong.
| Back | FazBrowse Home | New Git URL |
I propose to make this accessor non-static to allow developers build more flexible mechanism of subscription. For example I have code:
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!