Skip to content

Commit

Permalink
Expose OperatorService client (#902)
Browse files Browse the repository at this point in the history
  • Loading branch information
cretz authored Sep 1, 2022
1 parent d1f860c commit f4f143c
Show file tree
Hide file tree
Showing 4 changed files with 31 additions and 0 deletions.
4 changes: 4 additions & 0 deletions client/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ import (
commonpb "go.temporal.io/api/common/v1"
enumspb "go.temporal.io/api/enums/v1"
historypb "go.temporal.io/api/history/v1"
"go.temporal.io/api/operatorservice/v1"
"go.temporal.io/api/workflowservice/v1"

"go.temporal.io/sdk/converter"
Expand Down Expand Up @@ -385,6 +386,9 @@ type (
// service are not configured with internal semantics such as automatic retries.
WorkflowService() workflowservice.WorkflowServiceClient

// OperatorService creates a new operator service client with the same gRPC connection as this client.
OperatorService() operatorservice.OperatorServiceClient

// Close client and clean up underlying resources.
//
// If this client was created via NewClientFromExisting or this client has
Expand Down
4 changes: 4 additions & 0 deletions internal/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ import (

commonpb "go.temporal.io/api/common/v1"
enumspb "go.temporal.io/api/enums/v1"
"go.temporal.io/api/operatorservice/v1"
"go.temporal.io/api/workflowservice/v1"
uberatomic "go.uber.org/atomic"
"google.golang.org/grpc"
Expand Down Expand Up @@ -344,6 +345,9 @@ type (
// service are not configured with internal semantics such as automatic retries.
WorkflowService() workflowservice.WorkflowServiceClient

// OperatorService creates a new operator service client with the same gRPC connection as this client.
OperatorService() operatorservice.OperatorServiceClient

// Close client and clean up underlying resources.
Close()
}
Expand Down
6 changes: 6 additions & 0 deletions internal/internal_workflow_client.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ import (
commonpb "go.temporal.io/api/common/v1"
enumspb "go.temporal.io/api/enums/v1"
historypb "go.temporal.io/api/history/v1"
"go.temporal.io/api/operatorservice/v1"
querypb "go.temporal.io/api/query/v1"
"go.temporal.io/api/serviceerror"
taskqueuepb "go.temporal.io/api/taskqueue/v1"
Expand Down Expand Up @@ -902,6 +903,11 @@ func (wc *WorkflowClient) WorkflowService() workflowservice.WorkflowServiceClien
return wc.workflowService
}

// OperatorService implements Client.OperatorService.
func (wc *WorkflowClient) OperatorService() operatorservice.OperatorServiceClient {
return operatorservice.NewOperatorServiceClient(wc.conn)
}

// Get capabilities, lazily fetching from server if not already obtained.
func (wc *WorkflowClient) loadCapabilities() (*workflowservice.GetSystemInfoResponse_Capabilities, error) {
// While we want to memoize the result here, we take care not to lock during
Expand Down
17 changes: 17 additions & 0 deletions mocks/Client.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit f4f143c

Please sign in to comment.