swarrot / swarrot

A lib to consume message from any Broker
MIT License
364 stars 54 forks source link

Leverage ResetInterface #193

Closed lyrixx closed 4 years ago

lyrixx commented 5 years ago

Symfony propose a https://github.com/symfony/contracts/blob/master/Service/ResetInterface.php I think we could leverage this interface.

I'm thinking about doctrine and monolog.

For exemple, in monolog bundle, we clear eveything on kernel.reset. Doctrine does the same BTW.

So I think we need to add a dependency on the event dispatcher to be able to dispatch a kernel.reset event after each consumed message.

Thanks to that, we could depreciate some Processors :)

WDYT?

odolbeau commented 5 years ago

kernel.reset is a symfony event we can't rely on in a standalone library.

IMO, the only thing we could do is creating a new processor in charge of dispatching this event when a message have been consumed. This way, for people using the bundle, they'll be able to stop using some of our actual processors (like Doctrine and... that's all!) in favor of the new one.

Do you think it's relevant to do this?

lyrixx commented 5 years ago

This is a good idea :) Let's do it. Would you mind to create a PR?

odolbeau commented 5 years ago

Oh no, please do it, it's your idea, I definitively don't want to stole it! :)

lyrixx commented 5 years ago

Here we go: https://github.com/symfony/symfony/pull/32418

odolbeau commented 5 years ago

First step done, good job. :) You only have to create a new Processor in Swarrot & update the bundle in order to use it. :)

Thanks for your job! :heart: