From 0359fa46667af3c6ec2e4938fabf3112bd5f315f Mon Sep 17 00:00:00 2001 From: "Micael Levi (@micalevisk)" Date: Fri, 27 May 2022 23:35:08 -0400 Subject: [PATCH 1/2] fix(microservices): when `postfixId` is an empty string on kafka --- packages/microservices/client/client-kafka.ts | 2 +- packages/microservices/server/server-kafka.ts | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/microservices/client/client-kafka.ts b/packages/microservices/client/client-kafka.ts index 7aac2451f5f..ba9ad099a33 100644 --- a/packages/microservices/client/client-kafka.ts +++ b/packages/microservices/client/client-kafka.ts @@ -62,7 +62,7 @@ export class ClientKafka extends ClientProxy { const consumerOptions = this.getOptionsProp(this.options, 'consumer') || ({} as ConsumerConfig); const postfixId = - this.getOptionsProp(this.options, 'postfixId') || '-client'; + this.getOptionsProp(this.options, 'postfixId') ?? '-client'; this.producerOnlyMode = this.getOptionsProp(this.options, 'producerOnlyMode') || false; diff --git a/packages/microservices/server/server-kafka.ts b/packages/microservices/server/server-kafka.ts index 829d30d91bc..7287393e5fe 100644 --- a/packages/microservices/server/server-kafka.ts +++ b/packages/microservices/server/server-kafka.ts @@ -53,7 +53,7 @@ export class ServerKafka extends Server implements CustomTransportStrategy { const consumerOptions = this.getOptionsProp(this.options, 'consumer') || ({} as ConsumerConfig); const postfixId = - this.getOptionsProp(this.options, 'postfixId') || '-server'; + this.getOptionsProp(this.options, 'postfixId') ?? '-server'; this.brokers = clientOptions.brokers || [KAFKA_DEFAULT_BROKER]; From 1e5f548c110e3a7ce70ead9a7894573b1df76c14 Mon Sep 17 00:00:00 2001 From: "Micael Levi (@micalevisk)" Date: Fri, 27 May 2022 23:41:36 -0400 Subject: [PATCH 2/2] docs(microservices): clarify what is the default value of `postfixId` --- .../interfaces/microservice-configuration.interface.ts | 3 +++ 1 file changed, 3 insertions(+) diff --git a/packages/microservices/interfaces/microservice-configuration.interface.ts b/packages/microservices/interfaces/microservice-configuration.interface.ts index d5f33963262..e20b6ea531c 100644 --- a/packages/microservices/interfaces/microservice-configuration.interface.ts +++ b/packages/microservices/interfaces/microservice-configuration.interface.ts @@ -194,6 +194,9 @@ export interface KafkaParserConfig { export interface KafkaOptions { transport?: Transport.KAFKA; options?: { + /** + * Defaults to `"-server"` on server side and `"-client"` on client side. + */ postfixId?: string; client?: KafkaConfig; consumer?: ConsumerConfig;