Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: amqp-node/amqplib
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: v0.10.5
Choose a base ref
...
head repository: amqp-node/amqplib
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: v0.10.6
Choose a head ref
  • 8 commits
  • 10 files changed
  • 2 contributors

Commits on Nov 24, 2024

  1. Support channel options like highwatermark

    cressie176 committed Nov 24, 2024
    Copy the full SHA
    7d5f460 View commit details
  2. Fix tests

    cressie176 committed Nov 24, 2024
    Copy the full SHA
    6add58c View commit details

Commits on Dec 6, 2024

  1. Merge pull request #778 from amqp-node/configure-channel-highwatermark

    Support channel options like highwatermark
    cressie176 authored Dec 6, 2024

    Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature.
    Copy the full SHA
    c8ae9cd View commit details

Commits on Dec 28, 2024

  1. Replace references to the old squaremo/amqp.name repo with ones to am…

    …qp-node/amqplib
    cressie176 committed Dec 28, 2024
    Copy the full SHA
    b2c82f5 View commit details

Commits on Mar 26, 2025

  1. Use a frame_max of 131072 by default

    Just like nearly all client libraries do.
    
    In RabbitMQ 4.1.0, the pre-authentication default changes
    to 8192 to accommodate for larger JWT frames, which
    the current value in this client won't be compatible with.
    See [1].
    
    This default matches what RabbitMQ itself, the Java and .NET clients have been using since 2007.
    
    1. https://github.com/rabbitmq/rabbitmq-server/blob/main/release-notes/4.1.0.md#initial-amqp-0-9-1-maximum-frame-size
    michaelklishin authored Mar 26, 2025

    Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature.
    Copy the full SHA
    b17134f View commit details
  2. Merge pull request #787 from michaelklishin/patch-1

    Use a frame_max of 131072 by default for RabbitMQ 4.1.0 compatibility
    cressie176 authored Mar 26, 2025

    Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature.
    Copy the full SHA
    f62023e View commit details

Commits on Mar 29, 2025

  1. Update changelog

    cressie176 committed Mar 29, 2025
    Copy the full SHA
    1400f31 View commit details
  2. 0.10.6

    cressie176 committed Mar 29, 2025
    Copy the full SHA
    dd56742 View commit details
Showing with 94 additions and 15 deletions.
  1. +4 −0 CHANGELOG.md
  2. +2 −2 README.md
  3. +1 −1 bin/generate-defs.js
  4. +12 −2 lib/callback_model.js
  5. +5 −1 lib/channel.js
  6. +4 −2 lib/channel_model.js
  7. +2 −2 lib/connect.js
  8. +2 −2 package-lock.json
  9. +1 −1 package.json
  10. +61 −2 test/callback_api.js
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# Change log for amqplib

## v0.10.6
- Replace references to the old squaremo/amqp.name repo with ones to amqp-node/amqplib
- Use a frame_max of 131072 by default for RabbitMQ 4.1.0 compatibility

## Changes in v0.10.5

git log v0.10.4..v0.10.5
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -16,8 +16,8 @@
A library for making AMQP 0-9-1 clients for Node.JS, and an AMQP 0-9-1 client for Node.JS v10+.

This library does not implement [AMQP
1.0](https://github.com/squaremo/amqp.node/issues/63) or [AMQP
0-10](https://github.com/squaremo/amqp.node/issues/94).
1.0](https://github.com/amqp-node/amqplib/issues/63) or [AMQP
0-10](https://github.com/amqp-node/amqplib/issues/94).

Project status:

2 changes: 1 addition & 1 deletion bin/generate-defs.js
Original file line number Diff line number Diff line change
@@ -112,7 +112,7 @@ println(
'/** @preserve This file is generated by the script\n',
'* ../bin/generate-defs.js, which is not in general included in a\n',
'* distribution, but is available in the source repository e.g. at\n',
'* https://github.com/squaremo/amqp.node/\n',
'* https://github.com/amqp-node/amqplib/\n',
'*/');

println("'use strict';"); nl();
14 changes: 12 additions & 2 deletions lib/callback_model.js
Original file line number Diff line number Diff line change
@@ -28,8 +28,13 @@ class CallbackModel extends EventEmitter {
this.connection._updateSecret(newSecret, reason, cb);
}

createChannel (cb) {
createChannel (options, cb) {
if (arguments.length === 1) {
cb = options;
options = undefined;
}
var ch = new Channel(this.connection);
ch.setOptions(options);
ch.open(function (err, ok) {
if (err === null)
cb && cb(null, ch);
@@ -39,8 +44,13 @@ class CallbackModel extends EventEmitter {
return ch;
}

createConfirmChannel (cb) {
createConfirmChannel (options, cb) {
if (arguments.length === 1) {
cb = options;
options = undefined;
}
var ch = new ConfirmChannel(this.connection);
ch.setOptions(options);
ch.open(function (err) {
if (err !== null)
return cb && cb(err);
6 changes: 5 additions & 1 deletion lib/channel.js
Original file line number Diff line number Diff line change
@@ -47,8 +47,12 @@ class Channel extends EventEmitter {
this.handleMessage = acceptDeliveryOrReturn;
}

setOptions(options) {
this.options = options;
}

allocate () {
this.ch = this.connection.freshChannel(this);
this.ch = this.connection.freshChannel(this, this.options);
return this;
}

6 changes: 4 additions & 2 deletions lib/channel_model.js
Original file line number Diff line number Diff line change
@@ -30,14 +30,16 @@ class ChannelModel extends EventEmitter {
return promisify(this.connection._updateSecret.bind(this.connection))(newSecret, reason);
}

async createChannel() {
async createChannel(options) {
const channel = new Channel(this.connection);
channel.setOptions(options);
await channel.open();
return channel;
}

async createConfirmChannel() {
async createConfirmChannel(options) {
const channel = new ConfirmChannel(this.connection);
channel.setOptions(options);
await channel.open();
await channel.rpc(defs.ConfirmSelect, {nowait: false}, defs.ConfirmSelectOk);
return channel;
4 changes: 2 additions & 2 deletions lib/connect.js
Original file line number Diff line number Diff line change
@@ -31,7 +31,7 @@ var CLIENT_PROPERTIES = {
"product": "amqplib",
"version": require('../package.json').version,
"platform": fmt('Node.JS %s', process.version),
"information": "http://squaremo.github.io/amqp.node",
"information": "https://amqp-node.github.io/amqplib/",
"capabilities": {
"publisher_confirms": true,
"exchange_exchange_bindings": true,
@@ -66,7 +66,7 @@ function openFrames(vhost, query, credentials, extraClientProperties) {

// tune-ok
'channelMax': intOrDefault(query.channelMax, 0),
'frameMax': intOrDefault(query.frameMax, 0x1000),
'frameMax': intOrDefault(query.frameMax, 131072),
'heartbeat': intOrDefault(query.heartbeat, 0),

// open
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -2,7 +2,7 @@
"name": "amqplib",
"homepage": "http://amqp-node.github.io/amqplib/",
"main": "./channel_api.js",
"version": "0.10.5",
"version": "0.10.6",
"description": "An AMQP 0-9-1 (e.g., RabbitMQ) library and client.",
"repository": {
"type": "git",
63 changes: 61 additions & 2 deletions test/callback_api.js
Original file line number Diff line number Diff line change
@@ -72,10 +72,14 @@ suite('updateSecret', function() {
});

function channel_test_fn(method) {
return function(name, chfun) {
return function(name, options, chfun) {
if (arguments.length === 2) {
chfun = options;
options = {};
}
test(name, function(done) {
connect(kCallback(function(c) {
c[method](kCallback(function(ch) {
c[method](options, kCallback(function(ch) {
chfun(ch, done);
}, done));
}, done));
@@ -210,6 +214,33 @@ suite('sending messages', function() {
});
});

var channelOptions = {};

channel_test('find high watermark', function(ch, done) {
var msg = randomString();
var baseline = 0;
ch.assertQueue('', {exclusive: true}, function(e, q) {
if (e !== null) return done(e);
while (ch.sendToQueue(q.queue, Buffer.from(msg))) {
baseline++;
};
channelOptions.highWaterMark = baseline * 2;
done();
})
});

channel_test('set high watermark', channelOptions, function(ch, done) {
var msg = randomString();
ch.assertQueue('', {exclusive: true}, function(e, q) {
if (e !== null) return done(e);
var ok;
for (var i = 0; i < channelOptions.highWaterMark; i++) {
ok = ch.sendToQueue(q.queue, Buffer.from(msg));
assert.equal(ok, true);
}
done();
});
});
});

suite('ConfirmChannel', function() {
@@ -228,6 +259,34 @@ suite('ConfirmChannel', function() {
ch.waitForConfirms(done);
});

var channelOptions = {};

confirm_channel_test('find high watermark', function(ch, done) {
var msg = randomString();
var baseline = 0;
ch.assertQueue('', {exclusive: true}, function(e, q) {
if (e !== null) return done(e);
while (ch.sendToQueue(q.queue, Buffer.from(msg))) {
baseline++;
};
channelOptions.highWaterMark = baseline * 2;
done();
})
});

confirm_channel_test('set high watermark', channelOptions, function(ch, done) {
var msg = randomString();
ch.assertQueue('', {exclusive: true}, function(e, q) {
if (e !== null) return done(e);
var ok;
for (var i = 0; i < channelOptions.highWaterMark; i++) {
ok = ch.sendToQueue(q.queue, Buffer.from(msg));
assert.equal(ok, true);
}
done();
});
});

});

suite("Error handling", function() {