Skip to content
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

fix(microservices): allow postfixId on KafkaOptions to be an empty string #9681

Merged
merged 2 commits into from
Jun 15, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion packages/microservices/client/client-kafka.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Copy link
Member Author

@micalevisk micalevisk May 28, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we can't use @default tag here because KafkaOptions['options'] is being used by both client and server

*/
postfixId?: string;
client?: KafkaConfig;
consumer?: ConsumerConfig;
Expand Down
2 changes: 1 addition & 1 deletion packages/microservices/server/server-kafka.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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];

Expand Down