Skip to content

Commit 86a6edc

Browse files
authored
Readme merge (#8)
* Readme updates merge * Removed uber specific instructions
1 parent 0db052d commit 86a6edc

File tree

1 file changed

+65
-64
lines changed

1 file changed

+65
-64
lines changed

README.md

Lines changed: 65 additions & 64 deletions
Original file line numberDiff line numberDiff line change
@@ -1,63 +1,80 @@
1-
# Cadence Samples
2-
These are some samples to demonstrate various capabilities of Java Cadence client and server. You can learn more about cadence at:
1+
# Java Cadence Samples
2+
These samples demonstrate various capabilities of Java Cadence client and server. You can learn more about Cadence at:
33
* Cadence: https://github.com/uber/cadence
44
* Java Cadence Client: https://github.com/uber-java/cadence-client
55
* Go Cadence Client: https://github.com/uber-go/cadence-client
66

77
## Overview of the Samples
88

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.
20-
21-
* **FileProcessing** -- shows a workflow for media processing use case. The sample workflow
22-
downloads a file, processes it and uploads result to a destination. Demonstrates how to route activities to a
23-
specific host.
24-
25-
## Build Samples
26-
27-
We are working on getting [cadence-client library](https://github.com/uber-java/cadence-client) into a public Maven repository.
28-
In the meantime before running samples it has to be build to get it into the local maven cache.
29-
See instructions from the Cadence Client README for the instructions.
30-
31-
After cadence-client library is available just run
32-
33-
./gradlew build`
34-
35-
to build the samples. Verify that they actually can run:
36-
37-
./gradlew -q execute -PmainClass=com.uber.cadence.samples.common.RegisterDomain
38-
39-
## Prerequisite
40-
Run Cadence Server using Docker Compose
9+
* **HelloWorld Samples**
10+
11+
The following samples demonstrate:
12+
13+
* **HelloActivity**: a single activity workflow
14+
* **HelloActivityRetry**: how to retry an activity
15+
* **HelloAsync**: how to call activities asynchronously and wait for them using Promises
16+
* **HelloAsyncLambda**: how to run part of a workflow asynchronously in a separate task (thread)
17+
* **HelloAsyncActivityCompletion**: an asynchronous activity implementation
18+
* **HelloChild**: a child workflow
19+
* **HelloException**: exception propagation and wrapping
20+
* **HelloQuery**: a query
21+
* **HelloSignal**: sending and handling a signal
22+
* **HelloPeriodic**: a sample workflow that executes an activity periodically forever
23+
24+
* **FileProcessing** demonstrates task routing features. The sample workflow downloads a file, processes it, and uploads
25+
the result to a destination. The first activity can be picked up by any worker. However, the second and third activities
26+
must be executed on the same host as the first one.
27+
28+
## Get the Samples
29+
30+
Run the following commands:
31+
32+
git clone https://github.com/mfateev/uber-java-cadence-samples
33+
cd cadence-java-client-samples
34+
35+
## Import into IntelliJ
36+
37+
In the IntelliJ user interface, navigate to **File**->**New**->**Project from Existing Sources**.
38+
39+
Select the cloned directory. In the **Import Project page**, select **Import project from external model**,
40+
choose **Gradle** and then click **Next**->**Finish**.
41+
42+
## Build the Samples
43+
44+
Assumng that the https://github.com/uber-java/cadence-client is in local maven cache.
45+
46+
./gradlew build
47+
48+
If the latest samples stop building after you pull the latest version, refresh the Gradle dependencies:
49+
50+
./gradlew build --refresh-dependencies
51+
52+
Or, in IntelliJ, in the **Gradle projects** window, right-click "cadence-samples" and then click
53+
**Refresh dependencies**.
54+
55+
## Run Cadence Server
56+
57+
Run Cadence Server using Docker Compose:
4158

4259
curl -O https://raw.githubusercontent.com/uber/cadence/master/docker/docker-compose.yml
4360
docker-compose up
44-
45-
If it does not work see instructions for running the Cadence Server at https://github.com/uber/cadence/blob/master/README.md
4661

47-
## Registering Domain
62+
If this does not work, see the instructions for running Cadence Server at https://github.com/uber/cadence/blob/master/README.md.
63+
64+
## Register the Domain
4865

49-
Run it once before running any samples to register domain.
66+
To register the domain, run the follownig command once before running any samples:
5067

51-
./gradlew -q execute -PmainClass=com.uber.cadence.samples.common.RegisterDomain
68+
./gradlew -q execute -PmainClass=com.uber.cadence.samples.common.RegisterDomain
5269

53-
## Running the samples
70+
## Run the samples
5471

55-
Each sample has particular requirements for running it. Here's how to run each of the samples once
56-
you've built them using the preceding instructions.
72+
Each sample has specific requirements for running it. The following sections contain information about
73+
how to run each of the samples after you've built them using the preceding instructions.
5774

5875
### Hello World
5976

60-
To run hello world:
77+
To run the hello world samples:
6178

6279
./gradlew -q execute -PmainClass=com.uber.cadence.samples.hello.HelloActivity
6380
./gradlew -q execute -PmainClass=com.uber.cadence.samples.hello.HelloActivityRetry
@@ -72,29 +89,13 @@ To run hello world:
7289

7390
### File Processing
7491

75-
The *FileProcessing* sample uploads files to [Amazon S3](http://aws.amazon.com/s3/). To run this
76-
sample, you will need to first [create an S3
77-
bucket](http://docs.aws.amazon.com/AmazonS3/latest/gsg/CreatingABucket.html).
78-
79-
Then, locate the following section in the `access.properties` file and fill in the name of an S3
80-
bucket that you want the sample to use:
81-
82-
####### FileProcessing Sample Config Values ##########
83-
Workflow.Input.TargetBucketName=<Your S3 bucket name>
84-
85-
The sample has two executables. You should run each command in a separate terminal window. The first one
86-
is the worker that hosts workflow and activities implementation:
92+
This sample has two executables. Execute each command in a separate terminal window. The first command
93+
runs the worker that hosts the workflow and activities implementation. To demonstrate that activities
94+
execute together, we recommend that you run more than one instance of this worker.
8795

8896
./gradlew -q execute -PmainClass=com.uber.cadence.samples.fileprocessing.FileProcessingWorker
89-
90-
The second is responsible for starting workflows:
9197

92-
./gradlew -q execute -PmainClass=com.uber.cadence.samples.fileprocessing.FileProcessingStarter
93-
94-
### Split Merge
95-
96-
The sample has two executables. You should run each command in a separate terminal window.
98+
The second command starts workflows. Each invocation starts a new workflow execution.
9799

98-
./gradlew -q execute -PmainClass=com.uber.cadence.samples.splitmerge.SplitMergeWorker
99-
./gradlew -q execute -PmainClass=com.uber.cadence.samples.splitmerge.SplitMergeStarter
100+
./gradlew -q execute -PmainClass=com.uber.cadence.samples.fileprocessing.FileProcessingStarter
100101

0 commit comments

Comments
 (0)