Skip to content

Commit

Permalink
Contributor changes (#208)
Browse files Browse the repository at this point in the history
* 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]>
  • Loading branch information
5 people authored Jan 9, 2025
1 parent 2ab8c06 commit 7b1242f
Show file tree
Hide file tree
Showing 5 changed files with 55 additions and 48 deletions.
6 changes: 3 additions & 3 deletions docs/01-get-started/02-java-hello-world.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,12 @@ Go to the [Maven Repository Uber Cadence Java Client Page](https://mvnrepository
and find the latest version of the library. Include it as a dependency into your Java project. For example if you
are using Gradle the dependency looks like:
```bash
compile group: 'com.uber.cadence', name: 'cadence-client', version: '<latest_version>'
implementation group: 'com.uber.cadence', name: 'cadence-client', version: '<latest_version>'
```
Also add the following dependencies that cadence-client relies on:
```bash
compile group: 'commons-configuration', name: 'commons-configuration', version: '1.9'
compile group: 'ch.qos.logback', name: 'logback-classic', version: '1.2.3'
implementation group: 'commons-configuration', name: 'commons-configuration', version: '1.9'
implementation group: 'ch.qos.logback', name: 'logback-classic', version: '1.2.3'
```
Make sure that the following code compiles:
```java
Expand Down
4 changes: 2 additions & 2 deletions docs/03-concepts/05-topology.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ Note that both types of :worker:workers: as well as external clients are roles a
![Cadence Architecture](https://user-images.githubusercontent.com/14902200/160308507-2854a98a-0582-4748-87e4-e0695d3b6e86.jpg)


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:
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:
- 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.
- History Service: where the core logic of orchestrating workflow steps and activities is implemented
- 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
Expand All @@ -29,7 +29,7 @@ Internally it depends on a persistent store. Currently, Apache Cassandra, MySQL,

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:.

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.
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.

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

Expand Down
54 changes: 25 additions & 29 deletions docs/05-go-client/01-workers.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ package main

import (

"go.uber.org/cadence/.gen/go/cadence"
"go.uber.org/cadence/.gen/go/cadence/workflowserviceclient"
"go.uber.org/cadence/worker"

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

var HostPort = "127.0.0.1:7933"
var Domain = "SimpleDomain"
var TaskListName = "SimpleWorker"
var ClientName = "SimpleWorker"
var CadenceService = "cadence-frontend"
const (
HostPort = "127.0.0.1:7933"
Domain = "SimpleDomain"
TaskListName = "SimpleWorker"
ClientName = "SimpleWorker"
CadenceService = "cadence-frontend"
)

func main() {
startWorker(buildLogger(), buildCadenceClient())
}
var logger *zap.Logger

func buildLogger() *zap.Logger {
config := zap.NewDevelopmentConfig()
config.Level.SetLevel(zapcore.InfoLevel)
func init() {
config := zap.NewDevelopmentConfig()
config.Level.SetLevel(zapcore.InfoLevel)
logger = zap.Must(config.Build())
}

var err error
logger, err := config.Build()
func main() {
serviceClient := buildCadenceClient()
worker := buildWorker(serviceClient)
err := worker.Start()
if err != nil {
panic("Failed to setup logger")
logger.Fatal("Failed to start worker")
}

return logger
logger.Info("Started Worker.", zap.String("worker", TaskListName))
}

func buildCadenceClient() workflowserviceclient.Interface {
ch, err := tchannel.NewChannelTransport(tchannel.ServiceName(ClientName))
if err != nil {
panic("Failed to setup tchannel")
logger.Fatal("Failed to setup tchannel")
}
dispatcher := yarpc.NewDispatcher(yarpc.Config{
Name: ClientName,
Expand All @@ -64,31 +66,25 @@ func buildCadenceClient() workflowserviceclient.Interface {
},
})
if err := dispatcher.Start(); err != nil {
panic("Failed to start dispatcher")
logger.Fatal("Failed to start dispatcher")
}

return workflowserviceclient.New(dispatcher.ClientConfig(CadenceService))
}

func startWorker(logger *zap.Logger, service workflowserviceclient.Interface) {
func buildWorker(service workflowserviceclient.Interface) worker.Worker {
// TaskListName identifies set of client workflows, activities, and workers.
// It could be your group or client or application name.
workerOptions := worker.Options{
Logger: logger,
MetricsScope: tally.NewTestScope(TaskListName, map[string]string{}),
}

worker := worker.New(
return worker.New(
service,
Domain,
TaskListName,
workerOptions)
err := worker.Start()
if err != nil {
panic("Failed to start worker")
}

logger.Info("Started Worker.", zap.String("worker", TaskListName))
workerOptions,
)
}
```

Expand Down
2 changes: 1 addition & 1 deletion docs/05-go-client/05-child-workflows.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ cwo := workflow.ChildWorkflowOptions{
WorkflowID: "BID-SIMPLE-CHILD-WORKFLOW",
ExecutionStartToCloseTimeout: time.Minute * 30,
}
ctx = workflow.WithChildWorkflowOptions(ctx, cwo)
ctx = workflow.WithChildOptions(ctx, cwo)

var result string
future := workflow.ExecuteChildWorkflow(ctx, SimpleChildWorkflow, value)
Expand Down
37 changes: 24 additions & 13 deletions docs/06-cli/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -76,10 +76,13 @@ NAME:
cadence - A command-line tool for cadence users

USAGE:
cadence [global options] command [command options] [arguments...]
cadence [global options] command [command options]

VERSION:
0.18.4
CLI feature version: 1.7.0
Release version: v1.2.15-prerelease09-dirty
Build commit: 2024-12-19T14:34:35-08:00-b22774ad3
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.

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

GLOBAL OPTIONS:
--address value, --ad value host:port for cadence frontend service [$CADENCE_CLI_ADDRESS]
--domain value, --do value cadence workflow domain [$CADENCE_CLI_DOMAIN]
--context_timeout value, --ct value optional timeout for context of RPC call in seconds (default: 5) [$CADENCE_CONTEXT_TIMEOUT]
--help, -h show help
--version, -v print the version
--address value, --ad value host:port for cadence frontend service [$CADENCE_CLI_ADDRESS]
--domain value, --do value cadence workflow domain [$CADENCE_CLI_DOMAIN]
--context_timeout value, --ct value optional timeout for context of RPC call in seconds (default: 5) [$CADENCE_CONTEXT_TIMEOUT]
--jwt value optional JWT for authorization. Either this or --jwt-private-key is needed for jwt authorization [$CADENCE_CLI_JWT]
--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]
--transport value, -t value optional argument for transport protocol format, either 'grpc' or 'tchannel'. Defaults to tchannel if not provided [$CADENCE_CLI_TRANSPORT_PROTOCOL]
--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]
--help, -h show help
--version, -v print the version
```
And
```sh-session
Expand All @@ -103,9 +110,11 @@ NAME:
cadence workflow - Operate cadence workflow

USAGE:
cadence workflow command [command options] [arguments...]
cadence workflow command [command options]

COMMANDS:
restart, res restarts a previous workflow execution
diagnose, diag diagnoses a previous workflow execution
activity, act operate activities of workflow
show show workflow history
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
Expand All @@ -121,14 +130,16 @@ COMMANDS:
scan, sc, scanall scan workflow executions (need to enable Cadence server on ElasticSearch). It will be faster than listall, but result are not sorted.
count, cnt count number of workflow executions (need to enable Cadence server on ElasticSearch)
query query workflow execution
query-types list all available query types
stack query workflow execution with __stack_trace as query type
describe, desc show information of workflow execution
describeid, descid show information of workflow execution with given workflow_id and optional run_id (a shortcut of `describe -w <wid> -r <rid>`)
observe, ob show the progress of workflow history
observeid, obid show the progress of workflow history with given workflow_id and optional run_id (a shortcut of `observe -w <wid> -r <rid>`)
reset, rs reset the workflow, by either eventID or resetType.
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.
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.
batch batch operation on a list of workflows from query.
help, h Shows a list of commands or help for one command

OPTIONS:
--help, -h show help
Expand All @@ -140,15 +151,15 @@ NAME:
cadence workflow signal - signal a workflow execution

USAGE:
cadence workflow signal [command options] [arguments...]
cadence workflow signal [command options]

OPTIONS:
--workflow_id value, --wid value, -w value WorkflowID
--run_id value, --rid value, -r value RunID
--workflow_id value, -w value, --wid value WorkflowID
--run_id value, -r value, --rid value RunID
--name value, -n value SignalName
--input value, -i value Input for the signal, in JSON format.
--input_file value, --if value Input for the signal from JSON file.

--help, -h show help
```
And etc.

Expand Down

0 comments on commit 7b1242f

Please sign in to comment.