Skip to content

Commit

Permalink
Update grpc clients to use generated code (cadence-workflow#5598)
Browse files Browse the repository at this point in the history
  • Loading branch information
Shaddoll authored Jan 17, 2024
1 parent ab577f4 commit f5a7fa7
Show file tree
Hide file tree
Showing 17 changed files with 911 additions and 803 deletions.
199 changes: 0 additions & 199 deletions client/admin/grpcClient.go

This file was deleted.

1 change: 1 addition & 0 deletions client/admin/interface.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ import (
//go:generate gowrap gen -g -p . -i Client -t ../templates/retry.tmpl -o ../wrappers/retryable/admin_generated.go -v client=Admin
//go:generate gowrap gen -g -p . -i Client -t ../templates/metered.tmpl -o ../wrappers/metered/admin_generated.go -v client=Admin
//go:generate gowrap gen -g -p . -i Client -t ../templates/errorinjectors.tmpl -o ../wrappers/errorinjectors/admin_generated.go -v client=Admin
//go:generate gowrap gen -g -p . -i Client -t ../templates/grpc.tmpl -o ../wrappers/grpc/admin_generated.go -v client=Admin -v package=adminv1 -v path=github.com/uber/cadence-idl/go/proto/admin/v1 -v prefix=Admin

// Client is the interface exposed by admin service client
type Client interface {
Expand Down
9 changes: 5 additions & 4 deletions client/clientfactory.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ import (
"github.com/uber/cadence/client/history"
"github.com/uber/cadence/client/matching"
"github.com/uber/cadence/client/wrappers/errorinjectors"
"github.com/uber/cadence/client/wrappers/grpc"
"github.com/uber/cadence/client/wrappers/metered"
"github.com/uber/cadence/common"
"github.com/uber/cadence/common/dynamicconfig"
Expand Down Expand Up @@ -107,7 +108,7 @@ func (cf *rpcClientFactory) NewHistoryClientWithTimeout(timeout time.Duration) (

outboundConfig := cf.rpcFactory.GetDispatcher().ClientConfig(service.History)
if rpc.IsGRPCOutbound(outboundConfig) {
rawClient = history.NewGRPCClient(historyv1.NewHistoryAPIYARPCClient(outboundConfig))
rawClient = grpc.NewHistoryClient(historyv1.NewHistoryAPIYARPCClient(outboundConfig))
namedPort = membership.PortGRPC
} else {
rawClient = history.NewThriftClient(historyserviceclient.New(outboundConfig))
Expand Down Expand Up @@ -141,7 +142,7 @@ func (cf *rpcClientFactory) NewMatchingClientWithTimeout(
var namedPort = membership.PortTchannel
outboundConfig := cf.rpcFactory.GetDispatcher().ClientConfig(service.Matching)
if rpc.IsGRPCOutbound(outboundConfig) {
rawClient = matching.NewGRPCClient(matchingv1.NewMatchingAPIYARPCClient(outboundConfig))
rawClient = grpc.NewMatchingClient(matchingv1.NewMatchingAPIYARPCClient(outboundConfig))
namedPort = membership.PortGRPC
} else {
rawClient = matching.NewThriftClient(matchingserviceclient.New(outboundConfig))
Expand Down Expand Up @@ -173,7 +174,7 @@ func (cf *rpcClientFactory) NewAdminClientWithTimeoutAndConfig(
) (admin.Client, error) {
var client admin.Client
if rpc.IsGRPCOutbound(config) {
client = admin.NewGRPCClient(adminv1.NewAdminAPIYARPCClient(config))
client = grpc.NewAdminClient(adminv1.NewAdminAPIYARPCClient(config))
} else {
client = admin.NewThriftClient(adminserviceclient.New(config))
}
Expand All @@ -195,7 +196,7 @@ func (cf *rpcClientFactory) NewFrontendClientWithTimeoutAndConfig(
) (frontend.Client, error) {
var client frontend.Client
if rpc.IsGRPCOutbound(config) {
client = frontend.NewGRPCClient(
client = grpc.NewFrontendClient(
apiv1.NewDomainAPIYARPCClient(config),
apiv1.NewWorkflowAPIYARPCClient(config),
apiv1.NewWorkerAPIYARPCClient(config),
Expand Down
Loading

0 comments on commit f5a7fa7

Please sign in to comment.