3

I'm handling multiple events through an Event Subscriber instead of making separated Events/Listeners. I want to queue several of these events, but I haven't found a way to accomplish that. I've followed the official documentation, but there is no example how to choose what events I want to queue (not all the subscribers).

Any suggestions? (No individual Event/Listener, please)

Karl Hill
  • 12,937
  • 5
  • 58
  • 95
Alex29
  • 1,211
  • 2
  • 10
  • 20

1 Answers1

14

If anyone is interested in, I've found the solution looking deeper in the Event Dispatcher.

Implementing the contract ShouldQueue on the EventSubscriber works the same than a separated Event/Listener and enqueue the events on the database. This should be documented in the official site.

Regards.

Alex29
  • 1,211
  • 2
  • 10
  • 20
  • Thanks for this! I agree, it should be explicit in the docs. I'm assuming there's no way to have an Event Subscriber class contain some events which are queued and some which are not? – jeff-h Apr 04 '17 at 02:15
  • Thanks ! I was looking for a way to use event subscriber with queues but wasn't sure it would work as it isnt specified in the docs – YannPl Oct 26 '21 at 13:18