@@ -4,45 +4,47 @@ These are some samples to demonstrate various capabilities of Java Cadence clien
4
4
* Java Cadence Client: https://github.com/uber-java/cadence-client
5
5
* Go Cadence Client: https://github.com/uber-go/cadence-client
6
6
7
- ## Prerequisite
8
- Run Cadence Server
9
-
10
- See instructions for running the Cadence Server: https://github.com/uber/cadence/blob/master/README.md
11
-
12
- ## Build Samples
13
-
14
- We are working on getting [ cadence-client library] ( https://github.com/uber-java/cadence-client ) into a public Maven repository.
15
- In the meantime before running samples it has to be build to get it into the local maven cache.
16
- See instructions from the Cadence Client README for the instructions.
17
-
18
- After cadence-client library is available just run
19
-
20
- ./gradlew build`
21
-
22
- to build the samples. Verify that they actually can run:
23
-
24
- ./gradlew execute -PmainClass=com.uber.cadence.samples.hello.HelloActivity
25
-
26
7
## Overview of the Samples
27
8
28
- * ** HelloWorld** -- obligatory single activity workflow.
29
-
30
- * ** PeriodicWorkflow** -- shows how to create a workflow that periodically executes an activity which name
31
- and arguments are specified at runtime.
32
- The workflow can run for extended periods and hence it uses the _ continue as new execution_ feature.
9
+ * ** HelloWorld Samples**
10
+ * _ HelloActivity_ is a sample of a single activity workflow
11
+ * _ HelloActivityRetry_ demonstrates how to retry an activity
12
+ * _ HelloAsync_ is a sample of how to call activities asynchronously and wait for them using Promises.
13
+ * _ HelloAsyncLambda_ is a sample of how to run a part of a workflow asynchronously in a separate task (thread).
14
+ * _ HelloAsyncActivityCompletion_ is a sample of an asynchronous activity implementation.
15
+ * _ HelloChild_ is a sample of a child workflow
16
+ * _ HelloException_ demonstrates exception propagation and wrapping
17
+ * HelloQuery is a sample of a query
18
+ * HelloSignal is a sample of sending and handling a signal.
19
+ * HelloPeriodic is a sample workflow that executes an activity periodically forever.
33
20
34
21
* ** FileProcessing** -- shows a workflow for media processing use case. The sample workflow
35
22
downloads a file from an Amazon S3 bucket, creates a zip file and uploads that zip file back to
36
- S3. The sample uses the task routing feature.
23
+ S3. The sample uses the task routing feature. Requires AWS credentials.
37
24
38
25
* ** SplitMerge** -- the workflow in this sample processes a large data set by splitting it up into
39
26
smaller data sets. The sample calculates the average of a large set of numbers stored in a file in
40
27
S3. The smaller data sets are assigned to workers and the results of processing are merged to
41
- produce the final result.
28
+ produce the final result. Requires S3 credentials.
29
+
30
+ ## Build Samples
31
+
32
+ We are working on getting [ cadence-client library] ( https://github.com/uber-java/cadence-client ) into a public Maven repository.
33
+ In the meantime before running samples it has to be build to get it into the local maven cache.
34
+ See instructions from the Cadence Client README for the instructions.
35
+
36
+ After cadence-client library is available just run
37
+
38
+ ./gradlew build`
39
+
40
+ to build the samples. Verify that they actually can run:
42
41
42
+ ./gradlew -q execute -PmainClass=com.uber.cadence.samples.hello.HelloActivity
43
+
44
+
43
45
## Configuring Service and S3 Access Keys
44
46
45
- If you are running local container the HelloWorld and PeriodicWorkflow samples do not need any additional configuration.
47
+ If you are running local container the HelloWorld samples do not need any additional configuration.
46
48
47
49
The steps for configuring and building other samples for Java Cadence Client are:
48
50
@@ -75,11 +77,19 @@ The steps for configuring and building other samples for Java Cadence Client are
75
77
76
78
set AWS_SWF_SAMPLES_CONFIG=<Your SDK Directory>
77
79
80
+ ## Prerequisite
81
+ Run Cadence Server
82
+
83
+ curl -O https://raw.githubusercontent.com/uber/cadence/master/docker/docker-compose.yml
84
+ docker-compose up
85
+
86
+ If it does not work see instructions for running the Cadence Server at https://github.com/uber/cadence/blob/master/README.md
87
+
78
88
## Registering Domain
79
89
80
90
Run it once before running any samples to register domain.
81
91
82
- ./gradlew execute -PmainClass=com.uber.cadence.samples.common.RegisterDomain
92
+ ./gradlew -q execute -PmainClass=com.uber.cadence.samples.common.RegisterDomain
83
93
84
94
## Running the samples
85
95
@@ -90,7 +100,16 @@ you've built them using the preceding instructions.
90
100
91
101
To run hello world:
92
102
93
- ./gradlew execute -PmainClass=com.uber.cadence.samples.hello.HelloActivity
103
+ ./gradlew -q execute -PmainClass=com.uber.cadence.samples.hello.HelloActivity
104
+ ./gradlew -q execute -PmainClass=com.uber.cadence.samples.hello.HelloActivityRetry
105
+ ./gradlew -q execute -PmainClass=com.uber.cadence.samples.hello.HelloAsync
106
+ ./gradlew -q execute -PmainClass=com.uber.cadence.samples.hello.HelloAsyncActivityCompletion
107
+ ./gradlew -q execute -PmainClass=com.uber.cadence.samples.hello.HelloAsyncLambda
108
+ ./gradlew -q execute -PmainClass=com.uber.cadence.samples.hello.HelloChild
109
+ ./gradlew -q execute -PmainClass=com.uber.cadence.samples.hello.HelloException
110
+ ./gradlew -q execute -PmainClass=com.uber.cadence.samples.hello.HelloPeriodic
111
+ ./gradlew -q execute -PmainClass=com.uber.cadence.samples.hello.HelloQuery
112
+ ./gradlew -q execute -PmainClass=com.uber.cadence.samples.hello.HelloSignal
94
113
95
114
### File Processing
96
115
@@ -107,16 +126,16 @@ bucket that you want the sample to use:
107
126
The sample has two executables. You should run each command in a separate terminal window. The first one
108
127
is the worker that hosts workflow and activities implementation:
109
128
110
- ./gradlew execute -PmainClass=com.uber.cadence.samples.fileprocessing.FileProcessingWorker
129
+ ./gradlew -q execute -PmainClass=com.uber.cadence.samples.fileprocessing.FileProcessingWorker
111
130
112
131
The second is responsible for starting workflows:
113
132
114
- ./gradlew execute -PmainClass=com.uber.cadence.samples.fileprocessing.FileProcessingStarter
133
+ ./gradlew -q execute -PmainClass=com.uber.cadence.samples.fileprocessing.FileProcessingStarter
115
134
116
135
### Split Merge
117
136
118
137
The sample has two executables. You should run each command in a separate terminal window.
119
138
120
- ./gradlew execute -PmainClass=com.uber.cadence.samples.splitmerge.SplitMergeWorker
121
- ./gradlew execute -PmainClass=com.uber.cadence.samples.splitmerge.SplitMergeStarter
139
+ ./gradlew -q execute -PmainClass=com.uber.cadence.samples.splitmerge.SplitMergeWorker
140
+ ./gradlew -q execute -PmainClass=com.uber.cadence.samples.splitmerge.SplitMergeStarter
122
141
0 commit comments