-
Notifications
You must be signed in to change notification settings - Fork 476
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
no error event on createChannel since V10.0.0 #726
Comments
Hi @SSANSH, Something odd here. It does not make sense that The following code behaves as I would expect, and the same for me with amqplib v0.9.1 and v0.10.3 using node 18... const amqplib = require('amqplib');
(async () => {
const connection = await amqplib.connect('amqp://localhost:5672?channelMax=1');
connection.on('error', (error) => {
console.log('Connection Error', { error });
})
await createChannel();
await createChannel();
async function createChannel() {
try {
const channel = await connection.createChannel();
channel.on('close', (error) => {
console.log('Channel Close Event', { error });
});
channel.on('error', (error) => {
console.log('Channel Error Event', { error });
})
console.log('Channel Created OK')
} catch (error) {
console.log('Caught Error', { error });
}
}
})();
|
Since the version V10.0.0 and the update of the code "Use Native promises (#689, thank you @mohd-akram and @kibertoad)"
// Do the remarkably simple channel open handshake async open() { const ch = await this.allocate.bind(this)(); return ch.rpc(defs.ChannelOpen, {outOfBand: ""}, defs.ChannelOpenOk); }
When I create channel like this currentChannel = await conn.createChannel();
and listen for event close
The error event is never emit in case "No channels left to allocate" using :
currentChannel.on('error', (error) => { ....
You can reproduce by comment line if (next < 0 || next > this.channelMax) into amqplib/lib/connection.js, calling createChannel and listen for error event.
Thanks.
The text was updated successfully, but these errors were encountered: