Skip to content

Commit 8030d62

Browse files
authored
Removed calculator example and all S3 usage. (#6)
* Removed splitmerge * No more AWS dependencies * Removed SWF references
1 parent ac68a92 commit 8030d62

19 files changed

+42
-762
lines changed

README.md

Lines changed: 10 additions & 51 deletions
Original file line numberDiff line numberDiff line change
@@ -7,26 +7,21 @@ These are some samples to demonstrate various capabilities of Java Cadence clien
77
## Overview of the Samples
88

99
* **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
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
1717
* HelloQuery is a sample of a query
1818
* HelloSignal is a sample of sending and handling a signal.
1919
* HelloPeriodic is a sample workflow that executes an activity periodically forever.
2020

2121
* **FileProcessing** -- shows a workflow for media processing use case. The sample workflow
22-
downloads a file from an Amazon S3 bucket, creates a zip file and uploads that zip file back to
23-
S3. The sample uses the task routing feature. Requires AWS credentials.
22+
downloads a file, processes it and uploads result to a destination. Demonstrates how to route activities to a
23+
specific host.
2424

25-
* **SplitMerge** -- the workflow in this sample processes a large data set by splitting it up into
26-
smaller data sets. The sample calculates the average of a large set of numbers stored in a file in
27-
S3. The smaller data sets are assigned to workers and the results of processing are merged to
28-
produce the final result. Requires S3 credentials.
29-
3025
## Build Samples
3126

3227
We are working on getting [cadence-client library](https://github.com/uber-java/cadence-client) into a public Maven repository.
@@ -39,44 +34,8 @@ These are some samples to demonstrate various capabilities of Java Cadence clien
3934
4035
to build the samples. Verify that they actually can run:
4136

42-
./gradlew -q execute -PmainClass=com.uber.cadence.samples.hello.HelloActivity
37+
./gradlew -q execute -PmainClass=com.uber.cadence.samples.common.RegisterDomain
4338

44-
45-
## Configuring Service and S3 Access Keys
46-
47-
If you are running local container the HelloWorld samples do not need any additional configuration.
48-
49-
The steps for configuring and building other samples for Java Cadence Client are:
50-
51-
1. Open the `access.properties` file in the `samples` directory.
52-
53-
2. Update Cadence host and port values to a service API. Keep these values for a local Cadence service:
54-
55-
Cadence.host=127.0.0.1
56-
Cadence.port=7933
57-
58-
2. If planning to run samples that access S3 locate the following sections and fill in your Access Key ID and Secret Access Key.
59-
60-
# Fill in your AWS Access Key ID and Secret Access Key for S3
61-
# http://aws.amazon.com/security-credentials
62-
S3.Access.ID=<Your AWS Access Key>
63-
S3.Secret.Key=<Your AWS Secret Key>
64-
S3.Account.ID=<Your AWS Account ID>
65-
66-
67-
5. Save the `access.properties` file.
68-
69-
6. Set the environment variable `AWS_SWF_SAMPLES_CONFIG` to the full path of the directory
70-
containing the `access.properties` file.
71-
72-
On Linux, Unix or OS X, use this command to set the environment variable:
73-
74-
export AWS_SWF_SAMPLES_CONFIG=<Your SDK Directory>
75-
76-
On Windows run this command:
77-
78-
set AWS_SWF_SAMPLES_CONFIG=<Your SDK Directory>
79-
8039
## Prerequisite
8140
Run Cadence Server using Docker Compose
8241

access.properties

Lines changed: 0 additions & 37 deletions
This file was deleted.

log4j.properties

Lines changed: 0 additions & 9 deletions
This file was deleted.

src/main/java/com/uber/cadence/samples/common/ConfigHelper.java

Lines changed: 0 additions & 143 deletions
This file was deleted.

src/main/java/com/uber/cadence/samples/common/ConfigKeys.java

Lines changed: 0 additions & 32 deletions
This file was deleted.

src/main/java/com/uber/cadence/samples/common/QueryWorkflowExecution.java

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,9 @@
2020
import com.uber.cadence.WorkflowService;
2121
import com.uber.cadence.client.UntypedWorkflowStub;
2222
import com.uber.cadence.client.WorkflowClient;
23+
import com.uber.cadence.serviceclient.WorkflowServiceTChannel;
24+
25+
import static com.uber.cadence.samples.common.SampleConstants.DOMAIN;
2326

2427
/**
2528
* Simple example utility to query workflow execution using Cadence query API.
@@ -36,9 +39,7 @@ public static void main(String[] args) throws Exception {
3639
" <queryType> <workflowId> [<runId>]");
3740
System.exit(1);
3841
}
39-
ConfigHelper configHelper = ConfigHelper.createConfig();
40-
WorkflowService.Iface swfService = configHelper.createWorkflowClient();
41-
String domain = configHelper.getDomain();
42+
WorkflowService.Iface cadenceService = new WorkflowServiceTChannel();
4243

4344
String queryType = args[0];
4445

@@ -49,7 +50,7 @@ public static void main(String[] args) throws Exception {
4950
String runId = args[1];
5051
workflowExecution.setRunId(runId);
5152
}
52-
WorkflowClient client = WorkflowClient.newInstance(swfService, domain);
53+
WorkflowClient client = WorkflowClient.newInstance(cadenceService, DOMAIN);
5354
UntypedWorkflowStub workflow = client.newUntypedWorkflowStub(workflowExecution);
5455
String result = workflow.query(queryType, String.class);
5556

src/main/java/com/uber/cadence/samples/common/QueryWorkflowExecutionLocalReplay.java

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,11 @@
1818

1919
import com.uber.cadence.WorkflowExecution;
2020
import com.uber.cadence.WorkflowService;
21+
import com.uber.cadence.serviceclient.WorkflowServiceTChannel;
2122
import com.uber.cadence.worker.Worker;
2223

24+
import static com.uber.cadence.samples.common.SampleConstants.DOMAIN;
25+
2326
/**
2427
* Query workflow execution by getting history from Cadence and executing it on a local worker.
2528
* Use this approach to debug workflow execution in a local environment.
@@ -34,9 +37,7 @@ public static void main(String[] args) throws Exception {
3437
+ "<workflow implementation class> <workflowId> <runId> <queryType>");
3538
System.exit(1);
3639
}
37-
ConfigHelper configHelper = ConfigHelper.createConfig();
38-
WorkflowService.Iface swfService = configHelper.createWorkflowClient();
39-
String domain = configHelper.getDomain();
40+
WorkflowService.Iface cadenceService = new WorkflowServiceTChannel();
4041

4142
WorkflowExecution workflowExecution = new WorkflowExecution();
4243
String workflowId = args[1];
@@ -48,12 +49,11 @@ public static void main(String[] args) throws Exception {
4849
String implementationTypeName = args[0];
4950
@SuppressWarnings("unchecked")
5051
Class<Object> workflowImplementationType = (Class<Object>) Class.forName(implementationTypeName);
51-
Worker replayer = new Worker(swfService, domain, null, null);
52+
Worker replayer = new Worker(cadenceService, DOMAIN, null, null);
5253
replayer.registerWorkflowImplementationTypes(workflowImplementationType);
5354
System.out.println("Beginning query replay for " + workflowExecution);
5455
String queryResult = replayer.queryWorkflowExecution(workflowExecution, queryType, String.class);
5556
System.out.println("Done query replay for " + workflowExecution);
5657
System.out.println("Query result:\n" + queryResult);
5758
}
58-
5959
}

0 commit comments

Comments
 (0)