Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Question: Is there a way to receive only one message at a time and leave the rest on the queue? #365

Open
swilliams-a3digital opened this issue May 8, 2018 · 2 comments

Comments

@swilliams-a3digital
Copy link

I am new to amqp10 and I use this code to receive messages:

amqpClient.createReceiver(queueName).then(r => {
r.on('message', message => {
let subscriberMessage = new SubscriberMessage();
subscriberMessage.body = message.body;
this.handleMessage(subscriberMessage);
});

this works great for most cases, but I noticed that if 100 messages come into the queue at once, r.on message will fire 100 times immediately and all results get processed at the same time.

I'm looking for a way to only have the receiver process one message at a time. I read the docs, but don't really understand how to make this happen. I'm hoping there is simple change I can make to the policy somewhere. Any guidance would be greatly appreciated.

@amarzavery
Copy link
Collaborator

This repo is not actively being maintained or supported. I would recommend using rhea which is actively supported and has lesser issues.

@swilliams-a3digital
Copy link
Author

I figure it out with this.
this.amqpClient.createReceiver(queueName, { creditQuantum : 1, attach: { receiverSettleMode: 1 } }).then(r => {

thanks for tip about this library being dead.

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

No branches or pull requests

2 participants