Skip to content

Commit caca3c0

Browse files
author
yechun
committed
[ISSUE apache#999] add timeoutMillis param
1 parent c133cca commit caca3c0

File tree

2 files changed

+5
-4
lines changed

2 files changed

+5
-4
lines changed

admin/admin.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ type Admin interface {
3434
CreateTopic(ctx context.Context, opts ...OptionCreate) error
3535
DeleteTopic(ctx context.Context, opts ...OptionDelete) error
3636

37-
GetAllSubscriptionGroup(ctx context.Context, brokerAddr string) (*SubscriptionGroupWrapper, error)
37+
GetAllSubscriptionGroup(ctx context.Context, brokerAddr string, timeoutMillis time.Duration) (*SubscriptionGroupWrapper, error)
3838
FetchAllTopicList(ctx context.Context) (*TopicList, error)
3939
//GetBrokerClusterInfo(ctx context.Context) (*remote.RemotingCommand, error)
4040
FetchPublishMessageQueues(ctx context.Context, topic string) ([]*primitive.MessageQueue, error)
@@ -109,10 +109,10 @@ func NewAdmin(opts ...AdminOption) (*admin, error) {
109109
}, nil
110110
}
111111

112-
func (a *admin) GetAllSubscriptionGroup(ctx context.Context, brokerAddr string) (*SubscriptionGroupWrapper, error) {
112+
func (a *admin) GetAllSubscriptionGroup(ctx context.Context, brokerAddr string, timeoutMillis time.Duration) (*SubscriptionGroupWrapper, error) {
113113
cmd := remote.NewRemotingCommand(internal.ReqGetAllSubscriptionGroupConfig, nil, nil)
114114
a.cli.RegisterACL()
115-
response, err := a.cli.InvokeSync(ctx, brokerAddr, cmd, 3*time.Second)
115+
response, err := a.cli.InvokeSync(ctx, brokerAddr, cmd, timeoutMillis)
116116
if err != nil {
117117
rlog.Error("Get all group list error", map[string]interface{}{
118118
rlog.LogKeyUnderlayError: err,

examples/admin/group/main.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ package main
2020
import (
2121
"context"
2222
"fmt"
23+
"time"
2324

2425
"github.com/apache/rocketmq-client-go/v2/admin"
2526
"github.com/apache/rocketmq-client-go/v2/primitive"
@@ -39,7 +40,7 @@ func main() {
3940
)
4041

4142
// group list
42-
result, err := testAdmin.GetAllSubscriptionGroup(context.Background(), brokerAddr)
43+
result, err := testAdmin.GetAllSubscriptionGroup(context.Background(), brokerAddr, 3*time.Second)
4344
if err != nil {
4445
fmt.Println("GetAllSubscriptionGroup error:", err.Error())
4546
}

0 commit comments

Comments
 (0)