Skip to content

Commit cf36b70

Browse files
feat(microservices): add log about disconnected client (rmq)
1 parent 79dd6d0 commit cf36b70

1 file changed

Lines changed: 6 additions & 2 deletions

File tree

packages/microservices/client/client-rmq.ts

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import { EventEmitter } from 'events';
55
import { fromEvent, merge, Observable } from 'rxjs';
66
import { first, map, share, switchMap } from 'rxjs/operators';
77
import {
8+
DISCONNECTED_RMQ_MESSAGE,
89
DISCONNECT_EVENT,
910
ERROR_EVENT,
1011
RQM_DEFAULT_IS_GLOBAL_PREFETCH_COUNT,
@@ -52,6 +53,8 @@ export class ClientRMQ extends ClientProxy {
5253
public close(): void {
5354
this.channel && this.channel.close();
5455
this.client && this.client.close();
56+
this.channel = null;
57+
this.client = null;
5558
}
5659

5760
public consumeChannel() {
@@ -138,9 +141,10 @@ export class ClientRMQ extends ClientProxy {
138141

139142
public handleDisconnectError(client: any): void {
140143
client.addListener(DISCONNECT_EVENT, (err: any) => {
144+
this.logger.error(DISCONNECTED_RMQ_MESSAGE);
145+
this.logger.error(err);
146+
141147
this.close();
142-
this.client = null;
143-
return this.logger.error(err);
144148
});
145149
}
146150

0 commit comments

Comments
 (0)