Hi,
I'm working with jolicode/elastically and symfony/messenger and I'm facing a use case that seems to be not handled by this bundle.
I'm using a Doctrine subscriber to dispatch IndexationRequest for each indexed entity being persisted or updated.
As recommended in the documentation, i'm using this configuration to dispatch IndexationRequest in a memory queue, then group them in a MultipleIndexationRequest message thanks to IndexationRequestSpoolSubscriber.
I also added the console.event_subscriber tag to the IndexationRequestSpoolSubscriber service in order to flush index messages at console terminate event as I have many commands creating or updating entities.
But I have a third case that seems not handled by the bundle. In my application, I can create or update entities in async message handler (messages handled by messenger:consume workers), so several IndexationRequest can be dispatched by the handler. These IndexationRequest message stay the memory queue without being flushed by IndexationRequestSpoolSubscriber as it subscribes only to kernel and console event, but not to worker event.
I create my own subscriber to listen WorkerMessageHandledEvent that is dispatched when a worker handle successfully an async message.
What do you thing about adding this kind of listener to your IndexationRequestSpoolSubscriber ?
Hi,
I'm working with
jolicode/elasticallyandsymfony/messengerand I'm facing a use case that seems to be not handled by this bundle.I'm using a Doctrine subscriber to dispatch
IndexationRequestfor each indexed entity being persisted or updated.As recommended in the documentation, i'm using this configuration to dispatch
IndexationRequestin a memory queue, then group them in aMultipleIndexationRequestmessage thanks toIndexationRequestSpoolSubscriber.I also added the
console.event_subscribertag to theIndexationRequestSpoolSubscriberservice in order to flush index messages at console terminate event as I have many commands creating or updating entities.But I have a third case that seems not handled by the bundle. In my application, I can create or update entities in async message handler (messages handled by
messenger:consumeworkers), so severalIndexationRequestcan be dispatched by the handler. TheseIndexationRequestmessage stay the memory queue without being flushed byIndexationRequestSpoolSubscriberas it subscribes only to kernel and console event, but not to worker event.I create my own subscriber to listen
WorkerMessageHandledEventthat is dispatched when a worker handle successfully an async message.What do you thing about adding this kind of listener to your
IndexationRequestSpoolSubscriber?