Skip to content

Commit

Permalink
[ISSUE #999] add timeoutMillis param
Browse files Browse the repository at this point in the history
  • Loading branch information
Slideee committed Feb 22, 2023
1 parent c133cca commit caca3c0
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
6 changes: 3 additions & 3 deletions admin/admin.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ type Admin interface {
CreateTopic(ctx context.Context, opts ...OptionCreate) error
DeleteTopic(ctx context.Context, opts ...OptionDelete) error

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

func (a *admin) GetAllSubscriptionGroup(ctx context.Context, brokerAddr string) (*SubscriptionGroupWrapper, error) {
func (a *admin) GetAllSubscriptionGroup(ctx context.Context, brokerAddr string, timeoutMillis time.Duration) (*SubscriptionGroupWrapper, error) {
cmd := remote.NewRemotingCommand(internal.ReqGetAllSubscriptionGroupConfig, nil, nil)
a.cli.RegisterACL()
response, err := a.cli.InvokeSync(ctx, brokerAddr, cmd, 3*time.Second)
response, err := a.cli.InvokeSync(ctx, brokerAddr, cmd, timeoutMillis)
if err != nil {
rlog.Error("Get all group list error", map[string]interface{}{
rlog.LogKeyUnderlayError: err,
Expand Down
3 changes: 2 additions & 1 deletion examples/admin/group/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ package main
import (
"context"
"fmt"
"time"

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

// group list
result, err := testAdmin.GetAllSubscriptionGroup(context.Background(), brokerAddr)
result, err := testAdmin.GetAllSubscriptionGroup(context.Background(), brokerAddr, 3*time.Second)
if err != nil {
fmt.Println("GetAllSubscriptionGroup error:", err.Error())
}
Expand Down

0 comments on commit caca3c0

Please sign in to comment.