Skip to content

IndexationRequest dispatched by async message handler are not handled by IndexationRequestSpoolSubscriber #207

@maximecolin

Description

@maximecolin

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 ?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions