Skip to content

Commit 992919c

Browse files
authoredApr 11, 2024··
Merge pull request #756 from amqp-node/connection-update-secret
Add connection-update-secret
2 parents bbe579e + c4da58b commit 992919c

6 files changed

+658
-622
lines changed
 

‎Makefile

+2-3
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
1-
RABBITMQ_SRC_VERSION=rabbitmq_v3_2_1
1+
RABBITMQ_SRC_VERSION=v3.12.13
22
JSON=amqp-rabbitmq-0.9.1.json
3-
RABBITMQ_CODEGEN=https://raw.githubusercontent.com/rabbitmq/rabbitmq-codegen
4-
AMQP_JSON=$(RABBITMQ_CODEGEN)/$(RABBITMQ_SRC_VERSION)/$(JSON)
3+
AMQP_JSON=https://raw.githubusercontent.com/rabbitmq/rabbitmq-server/$(RABBITMQ_SRC_VERSION)/deps/rabbitmq_codegen/$(JSON)
54

65
NODEJS_VERSIONS='10.21' '11.15' '12.18' '13.14' '14.5' '15.8' '16.3.0' '18.1.0' '20.10.0'
76

‎lib/callback_model.js

+4
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,10 @@ class CallbackModel extends EventEmitter {
2424
this.connection.close(cb);
2525
}
2626

27+
updateSecret(newSecret, reason, cb) {
28+
this.connection._updateSecret(newSecret, reason, cb);
29+
}
30+
2731
createChannel (cb) {
2832
var ch = new Channel(this.connection);
2933
ch.open(function (err, ok) {

‎lib/channel_model.js

+4
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,10 @@ class ChannelModel extends EventEmitter {
2626
return promisify(this.connection.close.bind(this.connection))();
2727
}
2828

29+
updateSecret(newSecret, reason) {
30+
return promisify(this.connection._updateSecret.bind(this.connection))(newSecret, reason);
31+
}
32+
2933
async createChannel() {
3034
const channel = new Channel(this.connection);
3135
await channel.open();

‎lib/connection.js

+11
Original file line numberDiff line numberDiff line change
@@ -361,6 +361,14 @@ class Connection extends EventEmitter {
361361
this.emit('close', maybeErr);
362362
}
363363

364+
_updateSecret(newSecret, reason, cb) {
365+
this.sendMethod(0, defs.ConnectionUpdateSecret, {
366+
newSecret,
367+
reason
368+
});
369+
this.once('update-secret-ok', cb);
370+
}
371+
364372
// ===
365373
startHeartbeater () {
366374
if (this.heartbeat === 0)
@@ -611,6 +619,9 @@ function channel0(connection) {
611619
else if (f.id === defs.ConnectionUnblocked) {
612620
connection.emit('unblocked');
613621
}
622+
else if (f.id === defs.ConnectionUpdateSecretOk) {
623+
connection.emit('update-secret-ok');
624+
}
614625
else {
615626
connection.closeWithError(
616627
fmt("Unexpected frame on channel 0"),

0 commit comments

Comments
 (0)
Please sign in to comment.