Skip to content

Conversation

@jfromaniello
Copy link
Contributor

This is a major change, the current behavior is to ACK a message as soon as is received.

I am proposing instead to ACK the message once is processed. With the prefetch parameter unset, this almost the same than the current behavior.. rabbitmq will report that the messages are not acked yet but it will keep delivering messages as before.

But this allow us to configure the prefetch count which is very useful. Let's say we know our worker can't handle more than 5 operations at the time, with this change you can initialize the server as:

const server = new AMQPRPCServer(connection, { prefetchCount: 5 });

More info about prefetch here.

In addition to this I am using reject if the command fail, this is an ack the message but mark it as rejected and does not re-queues it. This is helpful when you are looking at rabbitmq metrics for example.

Copy link
Contributor

@anton-kotenko anton-kotenko left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks reasonable.

The only thing I'd like to ask is:
please bump major version of library in package.json.
To avoid surprises for somebody

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants