Hello 👋
I am working on a case where a Processor is processing a lot events which are all similar, but a bit different. In fact all the events share a common Interface.
Currently my Code looks roughly like this:
#[Processor('some.thing')]
final readonly class SomeProcessor
{
#[Subscribe(ThingHasHappenend::class)]
#[Subscribe(SimilairThingHasHappened::class)]
.... 45 more events
public function onNewAnswerableBlockAdded(Message $message): void
{
/** @var SomeCommenInterface $event */
$event = $message->event();
... do something with this event
}
}
Would it be possible to subscribe to a Interface and catch all events implementing it?
Thanks for the bundle!