Skip to content

[Question] Async ConsumerFunc #214

@AmauryD

Description

@AmauryD

I noticed that the ConsumerFunc does not support async, so the client doesn't wait for the consumer function to finish before processing more messages. The problem is that my CPU becomes overwhelmed when receiving 1,000,000 messages in a short amount of time.

Is there a way to solve this problem ? The only temporary fix I have is to enqueue all the asynchronous calls in a queue, but that seems a bit overkill and not very efficient.

const consumer = await this.client.declareConsumer({
            ...
 },  (message) => {
        this.worker.enqueue(async () => {
           ...
        })
 })

Thank you,

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