You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@rocketmq.apache.org by yu...@apache.org on 2024/10/08 09:41:25 UTC

(rocketmq-client-go) branch master updated: [ISSUE #1136] should also set Credentials for nameserver in admin and pull consumer (#1137)

This is an automated email from the ASF dual-hosted git repository.

yuzhou pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/rocketmq-client-go.git


The following commit(s) were added to refs/heads/master by this push:
     new 9462ea8  [ISSUE #1136] should also set Credentials for nameserver in admin and pull consumer (#1137)
9462ea8 is described below

commit 9462ea81043d90c3d7e96ee70739d115a2037342
Author: Vincent Lee <co...@gmail.com>
AuthorDate: Tue Oct 8 17:41:20 2024 +0800

    [ISSUE #1136] should also set Credentials for nameserver in admin and pull consumer (#1137)
    
    * should also set Credentials for nameserver in admin and pull consumer
    
    * should set Credentials for nameserver
---
 admin/admin.go            | 3 +++
 consumer/pull_consumer.go | 3 +++
 2 files changed, 6 insertions(+)

diff --git a/admin/admin.go b/admin/admin.go
index 62175af..a92a25c 100644
--- a/admin/admin.go
+++ b/admin/admin.go
@@ -102,6 +102,9 @@ func NewAdmin(opts ...AdminOption) (*admin, error) {
 	if err != nil {
 		return nil, err
 	}
+	if !defaultOpts.Credentials.IsEmpty() {
+		namesrv.SetCredentials(defaultOpts.Credentials)
+	}
 
 	cli := internal.GetOrNewRocketMQClient(defaultOpts.ClientOptions, nil)
 	if cli == nil {
diff --git a/consumer/pull_consumer.go b/consumer/pull_consumer.go
index a64c163..c66ffb7 100644
--- a/consumer/pull_consumer.go
+++ b/consumer/pull_consumer.go
@@ -92,6 +92,9 @@ func NewPullConsumer(options ...Option) (*defaultPullConsumer, error) {
 	if err != nil {
 		return nil, errors.Wrap(err, "new Namesrv failed.")
 	}
+	if !defaultOpts.Credentials.IsEmpty() {
+		srvs.SetCredentials(defaultOpts.Credentials)
+	}
 
 	defaultOpts.Namesrv = srvs
 	dc := &defaultConsumer{