Skip to content

Commit 7e7ddb9

Browse files
feat: handle close connection
1 parent 9e785e8 commit 7e7ddb9

File tree

2 files changed

+5
-1
lines changed

2 files changed

+5
-1
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@nestjstools/messaging-rabbitmq-extension",
3-
"version": "3.0.5",
3+
"version": "3.1.0",
44
"description": "Extension to handle messages and dispatch them over AMQP protocol",
55
"author": "Sebastian Iwanczyszyn",
66
"private": false,

src/channel/amqp.channel.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,10 @@ export class AmqpChannel extends Channel<ExtensionAmqpChannelConfig> {
1919
this.connection = undefined;
2020

2121
this.connection = await amqp.connect(this.config.connectionUri);
22+
this.connection.on('close', (err: any) => {
23+
console.error('AMQP Connection error:', err);
24+
process.exit(0);
25+
});
2226
}
2327

2428
async onChannelDestroy(): Promise<void> {

0 commit comments

Comments
 (0)