-
Notifications
You must be signed in to change notification settings - Fork 204
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
Client configuration add namespace #750
Client configuration add namespace #750
Conversation
nodejs/src/client/BaseClient.ts
Outdated
@@ -76,6 +77,7 @@ export abstract class BaseClient { | |||
readonly clientType = ClientType.CLIENT_TYPE_UNSPECIFIED; | |||
readonly sslEnabled: boolean; | |||
readonly #sessionCredentials?: SessionCredentials; | |||
readonly namespace?: string = ""; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
readonly namespace?: string;
即可,可选属性不需要设置空值。
nodejs/src/client/Settings.ts
Outdated
@@ -20,15 +20,17 @@ import { Endpoints } from '../route/Endpoints'; | |||
import { RetryPolicy } from '../retry'; | |||
|
|||
export abstract class Settings { | |||
protected readonly namespace: string | ""; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
protected readonly namespace: string;
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
+1
@@ -60,8 +60,11 @@ export class SimpleConsumer extends Consumer { | |||
} | |||
} | |||
this.#awaitDuration = options.awaitDuration ?? 30000; | |||
this.#simpleSubscriptionSettings = new SimpleSubscriptionSettings(this.clientId, this.endpoints, | |||
this.consumerGroup, this.requestTimeout, this.#awaitDuration, this.#subscriptionExpressions); | |||
if (options.namespace) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
这里给namespace初始化一个空字符串,就不需要多次判空了,proxy侧会兼容空字符串的情况将其认为是默认值
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm
Which Issue(s) This PR Fixes
Fixes #issue_id
Brief Description
How Did You Test This Change?