Skip to content

Commit 52275ff

Browse files
committed
TLS helloworld sample for gRPC calls to cadence
1 parent 21ff5b3 commit 52275ff

File tree

2 files changed

+14
-2
lines changed

2 files changed

+14
-2
lines changed

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,3 +15,6 @@ vendor/
1515
# Executables produced by cadence-samples repo
1616
bin/
1717
docker-compose.yml
18+
# Credentials
19+
new_samples/client_samples/helloworld_tls/credentials/
20+
credentials/

new_samples/worker/worker.go

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@ import (
1111
"go.uber.org/cadence/worker"
1212
"go.uber.org/cadence/workflow"
1313
"go.uber.org/yarpc"
14+
"go.uber.org/yarpc/peer"
15+
yarpchostport "go.uber.org/yarpc/peer/hostport"
1416
"go.uber.org/yarpc/transport/grpc"
1517
"go.uber.org/zap"
1618
"go.uber.org/zap/zapcore"
@@ -69,11 +71,18 @@ func StartWorker() {
6971

7072
}
7173

72-
func BuildCadenceClient() workflowserviceclient.Interface {
74+
func BuildCadenceClient(dialOptions ...grpc.DialOption) workflowserviceclient.Interface {
75+
grpcTransport := grpc.NewTransport()
76+
myChooser := peer.NewSingle(
77+
yarpchostport.Identify(HostPort),
78+
grpcTransport.NewDialer(dialOptions...),
79+
)
80+
outbound := grpcTransport.NewOutbound(myChooser)
81+
7382
dispatcher := yarpc.NewDispatcher(yarpc.Config{
7483
Name: ClientName,
7584
Outbounds: yarpc.Outbounds{
76-
CadenceService: {Unary: grpc.NewTransport().NewSingleOutbound(HostPort)},
85+
CadenceService: {Unary: outbound},
7786
},
7887
})
7988
if err := dispatcher.Start(); err != nil {

0 commit comments

Comments
 (0)