We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
Hi! Can anybody help me with the next issue:
So... if i try to call queue.shift() after messageObject.acknowledge, i get
Error: PRECONDITION_FAILED - unknown delivery tag 1
Question: How can i acknowledge messages and then request queue for another bundle of messages
Here some examples of my logic:
/** * * @param connection {Connection} * @param queue {Queue} */ runQueue(connection, queue) { this._connection = connection; this._queue = queue; queue.subscribe({ ack: true, prefetchCount: this._availableBots.length }, (message, headers, deliveryInfo, ack) => { message = JSON.parse(message.data.toString()); this.balance(message, ack); }); }
/** * * @param message {string} * @param messageObject {Message} */ balance(message, messageObject) { let selectedBot = null; for (const bot of this._bots) { if (!bot.busy) { selectedBot = bot; break; } } if (selectedBot) { this.run(message, messageObject, selectedBot) } else { this._tasks.push([message, messageObject]); if (this._availableBots.length) { this.createBot(); } } }
bot.on('free', (messageObject) => { console.log('freeBot'); bot.busy = false; if (messageObject) { messageObject.acknowledge(); } if (this._tasks.length) { let task = this._tasks.shift(); this.run(task[0], task[1], bot) } else { this._queue.shift(true); } });
The text was updated successfully, but these errors were encountered:
No branches or pull requests
Hi!
Can anybody help me with the next issue:
So... if i try to call queue.shift() after messageObject.acknowledge, i get
Error: PRECONDITION_FAILED - unknown delivery tag 1
Question: How can i acknowledge messages and then request queue for another bundle of messages
Here some examples of my logic:
The text was updated successfully, but these errors were encountered: