Skip to content

Commit

Permalink
fix(microservices): handle rmq queue deletion
Browse files Browse the repository at this point in the history
A null message is passed to callback when RabbitMQ queue is deleted. See nestjs#5683
  • Loading branch information
poulad committed Nov 26, 2020
1 parent 7c070f3 commit 34d1c45
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion packages/microservices/server/server-rmq.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
import { isString, isUndefined } from '@nestjs/common/utils/shared.utils';
import {
isNil,
isString,
isUndefined,
} from '@nestjs/common/utils/shared.utils';
import { Observable } from 'rxjs';
import {
CONNECT_EVENT,
Expand Down Expand Up @@ -111,6 +115,9 @@ export class ServerRMQ extends Server implements CustomTransportStrategy {
message: Record<string, any>,
channel: any,
): Promise<void> {
if (isNil(message)) {
return;
}
const { content, properties } = message;
const rawMessage = JSON.parse(content.toString());
const packet = this.deserializer.deserialize(rawMessage);
Expand Down

0 comments on commit 34d1c45

Please sign in to comment.