Comments (2)
If we comment out the per-consume prefetch like so:
import * as amqp from "amqplib";
(async () => {
const connection = await amqp.connect({
protocol: "amqp",
hostname: "localhost",
port: 5672,
username: "balanceAdmin",
password: "Aa123456",
});
const channel = await connection.createChannel();
channel.prefetch(42, true);
const { queue } = await channel.assertQueue("", { autoDelete: true });
// channel.prefetch(100, false);
channel.consume(queue, () => null, { noAck: true });
})();
then global prefetch is set to 42 as expected:
but per-consume prefetch is 0.
from amqplib.
Hi @soryy708
I've run your code through WireShark and see the following
channel.prefetch(42, true);
Advanced Message Queueing Protocol
Type: Method (1)
Channel: 1
Length: 11
Class: Basic (60)
Method: Qos (10)
Arguments
Prefetch-Size: 0
Prefetch-Count: 42
.... ...1 = Global: True
channel.prefetch(100, false);
Advanced Message Queueing Protocol
Type: Method (1)
Channel: 1
Length: 11
Class: Basic (60)
Method: Qos (10)
Arguments
Prefetch-Size: 0
Prefetch-Count: 100
.... ...0 = Global: False
So it looks like amqplib is sending the correct commands and arguments to the broker.
My best guess for what you're seeing in the management UI is that the channel's "prefetch count" and "global prefetch count" are the values that will be applied to subsequent consumer(s) created using this channel. Even if true, this is still misleading though since the RabbitMQ documentation states when both per-channel (global = true) and per-consumer (global = false) are set, both values are honoured.
The AMQP 0-9-1 specification does not explain what happens if you invoke basic.qos multiple times with different global values. RabbitMQ interprets this as meaning that the two prefetch limits should be enforced independently of each other; consumers will only receive new messages when neither limit on unacknowledged messages has been reached.
I think this one is for the RabbitMQ team / community.
from amqplib.
Related Issues (20)
- no error event on createChannel since V10.0.0 HOT 1
- Consider removing `readable-stream`? HOT 1
- Fanout delivery acknowledgement on channel 1 timed out HOT 6
- Set a custom header before nack-ing a message HOT 5
- No Error emitted when Queue disappears or is deleted HOT 2
- SDK connecting without errors after RabbitMQ service is shut down HOT 9
- Error emitted before handler is attached causes "Unhandled 'error' event" HOT 3
- consume does not respect promises? HOT 5
- Trailing dot in URL causes TLS failure HOT 2
- docs: channel api github page has broken top links HOT 2
- docs: confusing and inconsistent usage of terms "bork", "splode", "close" HOT 7
- ERR_SSL_EMS_NOT_ENABLED HOT 6
- How to determine if channel.ack() is successful? HOT 2
- CPU intensive controller prevents AMQP connection from receiving heartbeat, hence connections gets closed. HOT 2
- How to know if message is published ? HOT 6
- Aborting a Message Processing when RMQ Channel Closes HOT 8
- I'm encountering an "Unexpected close" error HOT 2
- Module not found: Can't resolve 'querystring' HOT 2
- Feature: Add support for AMQP 0.9.1 "update-secret" HOT 11
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from amqplib.