Skip to content

Commit 7b1242f

Browse files
ibarrajowbelguidoumgustavohenriqueNepoxxdianepanagiotopoulos
authored
Contributor changes (#208)
* Update 05-child-workflows.md * Update 01-workers.md Fiz unnecessary import and refactoring to improve readability * update cli examples * Fix typo in 05-topology.md multitentant -> multitenant * Update gradle configuration words https://docs.gradle.org/7.0/userguide/upgrading_version_6.html#sec:configuration_removal https://stackoverflow.com/questions/23796404/could-not-find-method-compile-for-arguments-gradle --------- Co-authored-by: Wissem Belguidoum <[email protected]> Co-authored-by: Gustavo Henrique <[email protected]> Co-authored-by: Nepoxx <[email protected]> Co-authored-by: Diane Panagiotopoulos <[email protected]>
1 parent 2ab8c06 commit 7b1242f

File tree

5 files changed

+55
-48
lines changed

5 files changed

+55
-48
lines changed

docs/01-get-started/02-java-hello-world.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,12 +18,12 @@ Go to the [Maven Repository Uber Cadence Java Client Page](https://mvnrepository
1818
and find the latest version of the library. Include it as a dependency into your Java project. For example if you
1919
are using Gradle the dependency looks like:
2020
```bash
21-
compile group: 'com.uber.cadence', name: 'cadence-client', version: '<latest_version>'
21+
implementation group: 'com.uber.cadence', name: 'cadence-client', version: '<latest_version>'
2222
```
2323
Also add the following dependencies that cadence-client relies on:
2424
```bash
25-
compile group: 'commons-configuration', name: 'commons-configuration', version: '1.9'
26-
compile group: 'ch.qos.logback', name: 'logback-classic', version: '1.2.3'
25+
implementation group: 'commons-configuration', name: 'commons-configuration', version: '1.9'
26+
implementation group: 'ch.qos.logback', name: 'logback-classic', version: '1.2.3'
2727
```
2828
Make sure that the following code compiles:
2929
```java

docs/03-concepts/05-topology.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ Note that both types of :worker:workers: as well as external clients are roles a
1818
![Cadence Architecture](https://user-images.githubusercontent.com/14902200/160308507-2854a98a-0582-4748-87e4-e0695d3b6e86.jpg)
1919

2020

21-
At the core of Cadence is a highly scalable multitentant service. The service exposes all of its functionality through a strongly typed [gRPC API](https://github.com/cadence-workflow/cadence-idl/tree/master/proto/cadence-workflow/cadence/api/v1). A Cadence cluster include multiple services, each of which may run on multiple nodes for scalability and reliablity:
21+
At the core of Cadence is a highly scalable multitenant service. The service exposes all of its functionality through a strongly typed [gRPC API](https://github.com/cadence-workflow/cadence-idl/tree/master/proto/cadence-workflow/cadence/api/v1). A Cadence cluster include multiple services, each of which may run on multiple nodes for scalability and reliablity:
2222
- Front End: which is a stateless service used to handle incoming requests from Workers. It is expected that an external load balancing mechanism is used to distribute load between Front End instances.
2323
- History Service: where the core logic of orchestrating workflow steps and activities is implemented
2424
- Matching Service: matches workflow/activity tasks that need to be executed to workflow/activity workers that are able to execute them. Matching is assigned task for execution by the history service
@@ -29,7 +29,7 @@ Internally it depends on a persistent store. Currently, Apache Cassandra, MySQL,
2929

3030
Cadence service is responsible for keeping :workflow: state and associated durable timers. It maintains internal queues (called :task_list:task_lists:) which are used to dispatch :task:tasks: to external :worker:workers:.
3131

32-
Cadence service is multitentant. Therefore it is expected that multiple pools of :worker:workers: implementing different use cases connect to the same service instance. For example, at Uber a single service is used by more than a hundred applications. At the same time some external customers deploy an instance of Cadence service per application. For local development, a local Cadence service instance configured through docker-compose is used.
32+
Cadence service is multitenant. Therefore it is expected that multiple pools of :worker:workers: implementing different use cases connect to the same service instance. For example, at Uber a single service is used by more than a hundred applications. At the same time some external customers deploy an instance of Cadence service per application. For local development, a local Cadence service instance configured through docker-compose is used.
3333

3434
![Cadence Overview](https://user-images.githubusercontent.com/14902200/160308592-400e11bc-0b21-4dd1-b568-8ac59005e6b7.svg)
3535

docs/05-go-client/01-workers.md

Lines changed: 25 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@ package main
1717

1818
import (
1919

20-
"go.uber.org/cadence/.gen/go/cadence"
2120
"go.uber.org/cadence/.gen/go/cadence/workflowserviceclient"
2221
"go.uber.org/cadence/worker"
2322

@@ -29,33 +28,36 @@ import (
2928
"go.uber.org/yarpc/transport/tchannel"
3029
)
3130

32-
var HostPort = "127.0.0.1:7933"
33-
var Domain = "SimpleDomain"
34-
var TaskListName = "SimpleWorker"
35-
var ClientName = "SimpleWorker"
36-
var CadenceService = "cadence-frontend"
31+
const (
32+
HostPort = "127.0.0.1:7933"
33+
Domain = "SimpleDomain"
34+
TaskListName = "SimpleWorker"
35+
ClientName = "SimpleWorker"
36+
CadenceService = "cadence-frontend"
37+
)
3738

38-
func main() {
39-
startWorker(buildLogger(), buildCadenceClient())
40-
}
39+
var logger *zap.Logger
4140

42-
func buildLogger() *zap.Logger {
43-
config := zap.NewDevelopmentConfig()
44-
config.Level.SetLevel(zapcore.InfoLevel)
41+
func init() {
42+
config := zap.NewDevelopmentConfig()
43+
config.Level.SetLevel(zapcore.InfoLevel)
44+
logger = zap.Must(config.Build())
45+
}
4546

46-
var err error
47-
logger, err := config.Build()
47+
func main() {
48+
serviceClient := buildCadenceClient()
49+
worker := buildWorker(serviceClient)
50+
err := worker.Start()
4851
if err != nil {
49-
panic("Failed to setup logger")
52+
logger.Fatal("Failed to start worker")
5053
}
51-
52-
return logger
54+
logger.Info("Started Worker.", zap.String("worker", TaskListName))
5355
}
5456

5557
func buildCadenceClient() workflowserviceclient.Interface {
5658
ch, err := tchannel.NewChannelTransport(tchannel.ServiceName(ClientName))
5759
if err != nil {
58-
panic("Failed to setup tchannel")
60+
logger.Fatal("Failed to setup tchannel")
5961
}
6062
dispatcher := yarpc.NewDispatcher(yarpc.Config{
6163
Name: ClientName,
@@ -64,31 +66,25 @@ func buildCadenceClient() workflowserviceclient.Interface {
6466
},
6567
})
6668
if err := dispatcher.Start(); err != nil {
67-
panic("Failed to start dispatcher")
69+
logger.Fatal("Failed to start dispatcher")
6870
}
6971

7072
return workflowserviceclient.New(dispatcher.ClientConfig(CadenceService))
7173
}
7274

73-
func startWorker(logger *zap.Logger, service workflowserviceclient.Interface) {
75+
func buildWorker(service workflowserviceclient.Interface) worker.Worker {
7476
// TaskListName identifies set of client workflows, activities, and workers.
7577
// It could be your group or client or application name.
7678
workerOptions := worker.Options{
7779
Logger: logger,
7880
MetricsScope: tally.NewTestScope(TaskListName, map[string]string{}),
7981
}
80-
81-
worker := worker.New(
82+
return worker.New(
8283
service,
8384
Domain,
8485
TaskListName,
85-
workerOptions)
86-
err := worker.Start()
87-
if err != nil {
88-
panic("Failed to start worker")
89-
}
90-
91-
logger.Info("Started Worker.", zap.String("worker", TaskListName))
86+
workerOptions,
87+
)
9288
}
9389
```
9490

docs/05-go-client/05-child-workflows.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ cwo := workflow.ChildWorkflowOptions{
1616
WorkflowID: "BID-SIMPLE-CHILD-WORKFLOW",
1717
ExecutionStartToCloseTimeout: time.Minute * 30,
1818
}
19-
ctx = workflow.WithChildWorkflowOptions(ctx, cwo)
19+
ctx = workflow.WithChildOptions(ctx, cwo)
2020

2121
var result string
2222
future := workflow.ExecuteChildWorkflow(ctx, SimpleChildWorkflow, value)

docs/06-cli/index.md

Lines changed: 24 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -76,10 +76,13 @@ NAME:
7676
cadence - A command-line tool for cadence users
7777

7878
USAGE:
79-
cadence [global options] command [command options] [arguments...]
79+
cadence [global options] command [command options]
8080

8181
VERSION:
82-
0.18.4
82+
CLI feature version: 1.7.0
83+
Release version: v1.2.15-prerelease09-dirty
84+
Build commit: 2024-12-19T14:34:35-08:00-b22774ad3
85+
Note: CLI feature version is for compatibility checking between server and CLI if enabled feature checking. Server is always backward compatible to older CLI versions, but not accepting newer than it can support.
8386

8487
COMMANDS:
8588
domain, d Operate cadence domain
@@ -90,11 +93,15 @@ COMMANDS:
9093
help, h Shows a list of commands or help for one command
9194

9295
GLOBAL OPTIONS:
93-
--address value, --ad value host:port for cadence frontend service [$CADENCE_CLI_ADDRESS]
94-
--domain value, --do value cadence workflow domain [$CADENCE_CLI_DOMAIN]
95-
--context_timeout value, --ct value optional timeout for context of RPC call in seconds (default: 5) [$CADENCE_CONTEXT_TIMEOUT]
96-
--help, -h show help
97-
--version, -v print the version
96+
--address value, --ad value host:port for cadence frontend service [$CADENCE_CLI_ADDRESS]
97+
--domain value, --do value cadence workflow domain [$CADENCE_CLI_DOMAIN]
98+
--context_timeout value, --ct value optional timeout for context of RPC call in seconds (default: 5) [$CADENCE_CONTEXT_TIMEOUT]
99+
--jwt value optional JWT for authorization. Either this or --jwt-private-key is needed for jwt authorization [$CADENCE_CLI_JWT]
100+
--jwt-private-key value, --jwt-pk value optional private key path to create JWT. Either this or --jwt is needed for jwt authorization. --jwt flag has priority over this one if both provided [$CADENCE_CLI_JWT_PRIVATE_KEY]
101+
--transport value, -t value optional argument for transport protocol format, either 'grpc' or 'tchannel'. Defaults to tchannel if not provided [$CADENCE_CLI_TRANSPORT_PROTOCOL]
102+
--tls_cert_path value, --tcp value optional argument for path to TLS certificate. Defaults to an empty string if not provided [$CADENCE_CLI_TLS_CERT_PATH]
103+
--help, -h show help
104+
--version, -v print the version
98105
```
99106
And
100107
```sh-session
@@ -103,9 +110,11 @@ NAME:
103110
cadence workflow - Operate cadence workflow
104111

105112
USAGE:
106-
cadence workflow command [command options] [arguments...]
113+
cadence workflow command [command options]
107114

108115
COMMANDS:
116+
restart, res restarts a previous workflow execution
117+
diagnose, diag diagnoses a previous workflow execution
109118
activity, act operate activities of workflow
110119
show show workflow history
111120
showid show workflow history with given workflow_id and run_id (a shortcut of `show -w <wid> -r <rid>`). run_id is only required for archived history
@@ -121,14 +130,16 @@ COMMANDS:
121130
scan, sc, scanall scan workflow executions (need to enable Cadence server on ElasticSearch). It will be faster than listall, but result are not sorted.
122131
count, cnt count number of workflow executions (need to enable Cadence server on ElasticSearch)
123132
query query workflow execution
133+
query-types list all available query types
124134
stack query workflow execution with __stack_trace as query type
125135
describe, desc show information of workflow execution
126136
describeid, descid show information of workflow execution with given workflow_id and optional run_id (a shortcut of `describe -w <wid> -r <rid>`)
127137
observe, ob show the progress of workflow history
128138
observeid, obid show the progress of workflow history with given workflow_id and optional run_id (a shortcut of `observe -w <wid> -r <rid>`)
129139
reset, rs reset the workflow, by either eventID or resetType.
130-
reset-batch reset workflow in batch by resetType: LastDecisionCompleted,LastContinuedAsNew,BadBinary,DecisionCompletedTime,FirstDecisionScheduled,LastDecisionScheduled,FirstDecisionCompletedTo get base workflowIDs/runIDs to reset, source is from input file or visibility query.
140+
reset-batch reset workflow in batch by resetType: LastContinuedAsNew,BadBinary,DecisionCompletedTime,FirstDecisionScheduled,LastDecisionScheduled,FirstDecisionCompleted,LastDecisionCompletedTo get base workflowIDs/runIDs to reset, source is from input file or visibility query.
131141
batch batch operation on a list of workflows from query.
142+
help, h Shows a list of commands or help for one command
132143

133144
OPTIONS:
134145
--help, -h show help
@@ -140,15 +151,15 @@ NAME:
140151
cadence workflow signal - signal a workflow execution
141152

142153
USAGE:
143-
cadence workflow signal [command options] [arguments...]
154+
cadence workflow signal [command options]
144155

145156
OPTIONS:
146-
--workflow_id value, --wid value, -w value WorkflowID
147-
--run_id value, --rid value, -r value RunID
157+
--workflow_id value, -w value, --wid value WorkflowID
158+
--run_id value, -r value, --rid value RunID
148159
--name value, -n value SignalName
149160
--input value, -i value Input for the signal, in JSON format.
150161
--input_file value, --if value Input for the signal from JSON file.
151-
162+
--help, -h show help
152163
```
153164
And etc.
154165

0 commit comments

Comments
 (0)