Skip to content

Commit 8c73665

Browse files
author
Maxim Fateev
committed
Fixed errors due to API changes
1 parent 4b3b0d2 commit 8c73665

21 files changed

+115
-563
lines changed

README.md

+15-121
Original file line numberDiff line numberDiff line change
@@ -82,112 +82,9 @@ you've built them using the preceding instructions.
8282

8383
### Hello World
8484

85-
The sample has three executables. You should run each command in a separate terminal window, from
86-
the `samples` directory.
85+
To run hello world:
8786

88-
mvn exec:java -Dexec.mainClass=HelloWorldWorker
89-
mvn exec:java -Dexec.mainClass=com.amazonaws.services.simpleworkflow.flow.examples.helloworld.WorkflowHost
90-
mvn exec:java -Dexec.mainClass=HelloWorldStarter
91-
92-
### Hello Lambda
93-
94-
The *HelloLambda* sample requires the use of an [AWS Lambda](http://aws.amazon.com/lambda/)
95-
function. You can create the function in any way supported by AWS Lambda, including by using the AWS
96-
Eclipse Toolkit.
97-
98-
**Note**: Using Lambda can incur costs to your AWS account. For more information, see the [AWS
99-
Lambda Pricing page](http://aws.amazon.com/lambda/pricing/).
100-
101-
Visit the following pages to learn how to create AWS Lambda functions:
102-
103-
* [in Java using Eclipse](http://docs.aws.amazon.com/AWSToolkitEclipse/latest/GettingStartedGuide/lambda-tutorial.html).
104-
105-
* [in Java without Eclipse](http://docs.aws.amazon.com/lambda/latest/dg/java-lambda.html).
106-
107-
* [in Node.js](http://docs.aws.amazon.com/lambda/latest/dg/authoring-function-in-nodejs.html).
108-
109-
When you create the function, be sure that it exists in the same AWS region that you will run the
110-
*HelloLambda* sample in. You will also need to provide Amazon SWF with access to your Lambda
111-
function in order to run it using the sample.
112-
113-
**To create a Lambda role for SWF:**
114-
115-
1. Open the [Amazon IAM console](https://console.aws.amazon.com/iam/)
116-
117-
2. Click **Roles**, then **Create New Role**.
118-
119-
3. Give your role a name, such as `swf-lambda' and click **Next Step**.
120-
121-
4. Under **AWS Service Roles**, choose **AWS SWF**, and click **Next Step**.
122-
123-
5. Choose **AWSLambdaRole** from the list, click **Next Step** and then **Create Role** once you've
124-
reviewed the role.
125-
126-
Once you have a Lambda function to run and an IAM policy that gives SWF access to it, then find the
127-
following section in the `access.properties` file and provide it with information about the function
128-
and role that you created:
129-
130-
####### HelloLambda Sample Config Values ######
131-
SWF.LambdaRole.ARN=<Your IAM role that authorizes SWF to invoke Lambda functions>
132-
SWFLambdaFunction.Name=<The name of your Lambda function>
133-
SWFLambdaFunction.Input=<Input for your Lambda function>
134-
135-
The *HelloLambda* sample uses an AWS Lambda task instead of running an activity, so you only need to
136-
run the workflow host and workflow starter. Run each command in a separate terminal window from the
137-
`samples` directory.
138-
139-
mvn exec:java -Dexec.mainClass=com.amazonaws.services.simpleworkflow.flow.examples.hellolambda.WorkflowHost
140-
mvn exec:java -Dexec.mainClass=com.amazonaws.services.simpleworkflow.flow.examples.hellolambda.WorkflowExecutionStarter
141-
142-
### Booking
143-
144-
The sample has three executables. You should run each command in a separate terminal window, from
145-
the `samples` directory.
146-
147-
mvn exec:java -Dexec.mainClass=ActivityHost
148-
mvn exec:java -Dexec.mainClass=WorkflowHost
149-
mvn exec:java -Dexec.mainClass=WorkflowExecutionStarter
150-
151-
### Cron
152-
153-
The sample has three executables. You should run each command in a separate terminal window, from
154-
the `samples` directory.
155-
156-
mvn exec:java -Dexec.mainClass=ActivityHost
157-
mvn exec:java -Dexec.mainClass=WorkflowHost
158-
mvn exec:java -Dexec.mainClass=CronWorkflowExecutionStarter -Dexec.args="\"*/10 * * * * *\" PST 60"
159-
160-
The workflow starter takes three command line arguments that *must* be specified:
161-
162-
1. CRON_PATTERN: specifies the pattern used to determine the cron schedule for the periodic activity
163-
task. The above command specifies the pattern `*/10 * * * * *` to run the task every 10 seconds.
164-
165-
2. TIME_ZONE: specifies the time zone to use for time calculations. The above command specifies PST
166-
(Pacific Standard Time).
167-
168-
3. CONTINUE_AS_NEW_AFTER_SECONDS: specifies the duration, in seconds, after which the current
169-
execution should be closed and continued as a new execution. The above command specifies 60 seconds.
170-
171-
### Cron With Retry
172-
173-
The sample has three executables. You should run each command in a separate terminal window, from
174-
the `samples` directory.
175-
176-
mvn exec:java -Dexec.mainClass=ActivityHost
177-
mvn exec:java -Dexec.mainClass=WorkflowHost
178-
mvn exec:java -Dexec.mainClass=CronWithRetryWorkflowExecutionStarter" -Dmain-args="\"*/10 * * * * *\" PST 60
179-
180-
The workflow starter takes three command line arguments that *must* be specified:
181-
182-
1. CRON_PATTERN: specifies the pattern used to determine the cron schedule for the periodic activity
183-
task. The above command specifies the pattern `*/10 * * * * *` to run the task every 10 seconds.
184-
185-
2. TIME_ZONE: specifies the time zone to use for time calculations. The above command specifies PST
186-
(Pacific Standard Time).
187-
188-
3. CONTINUE_AS_NEW_AFTER_SECONDS: specifies the duration, in seconds, after which the current
189-
execution should be closed and continued as a new execution. The above command specifies 60
190-
seconds.
87+
mvn exec:java -Dexec.mainClass=com.uber.cadence.samples.helloworld.HelloWorld
19188

19289
### File Processing
19390

@@ -201,28 +98,25 @@ bucket that you want the sample to use:
20198
####### FileProcessing Sample Config Values ##########
20299
Workflow.Input.TargetBucketName=<Your S3 bucket name>
203100

204-
The sample has three executables. You should run each command in a separate terminal window, from
205-
the `samples` directory.
101+
The sample has two executables. You should run each command in a separate terminal window. The first one
102+
is the worker that hosts workflow and activities implementation:
206103

207-
mvn exec:java -Dexec.mainClass=ActivityHost
208-
mvn exec:java -Dexec.mainClass=WorkflowHost
209-
mvn exec:java -Dexec.mainClass=WorkflowExecutionStarter
104+
mvn exec:java -Dexec.mainClass=com.uber.cadence.samples.fileprocessing.FileProcessingWorker
105+
106+
The second is responsible for starting workflows:
210107

108+
mvn exec:java -Dexec.mainClass=com.uber.cadence.samples.fileprocessing.FileProcessingStarter
109+
211110
### Periodic Workflow
212111

213-
The sample has three executables. You should run each command in a separate terminal window, from
214-
the `samples` directory.
215-
216-
mvn exec:java -Dexec.mainClass=PeriodicWorkflowWorker
217-
mvn exec:java -Dexec.mainClass=com.amazonaws.services.simpleworkflow.flow.examples.periodicworkflow.WorkflowHost
218-
mvn exec:java -Dexec.mainClass=WorkflowExecutionStarter
112+
mvn exec:java -Dexec.mainClass=com.uber.cadence.samples.periodicworkflow.PeriodicWorkflowWorker
113+
114+
mvn exec:java -Dexec.mainClass=com.uber.cadence.samples.periodicworkflow.PeriodicWorkflowStarter
219115

220116
### Split Merge
221117

222-
The sample has three executables. You should run each command in a separate terminal window, from
223-
the `samples` directory.
118+
The sample has two executables. You should run each command in a separate terminal window.
224119

225-
mvn exec:java -Dexec.mainClass=ActivityHost
226-
mvn exec:java -Dexec.mainClass=WorkflowHost
227-
mvn exec:java -Dexec.mainClass=WorkflowExecutionStarter
120+
mvn exec:java -Dexec.mainClass=com.uber.cadence.samples.splitmerge.SplitMergeWorker
121+
mvn exec:java -Dexec.mainClass=com.uber.cadence.samples.splitmerge.SplitMergeStarter
228122

pom.xml

+62-117
Original file line numberDiff line numberDiff line change
@@ -1,124 +1,69 @@
11
<?xml version="1.0" encoding="UTF-8"?>
22
<project xmlns="http://maven.apache.org/POM/4.0.0"
3-
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
4-
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
5-
<modelVersion>4.0.0</modelVersion>
3+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
4+
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
5+
<modelVersion>4.0.0</modelVersion>
66

7-
<groupId>com.uber</groupId>
8-
<artifactId>cadence-flow-samples</artifactId>
9-
<name>Samples for Cadence. Based on samples for AWS SWF</name>
10-
<version>0.0.1</version>
11-
<description>This artifact contains the Cadence Service Samples</description>
12-
<url>https://github.com/aws/aws-swf-flow-library</url>
13-
<licenses>
14-
<license>
15-
<name>Apache License, Version 2.0</name>
16-
<url>https://aws.amazon.com/apache2.0</url>
17-
<distribution>repo</distribution>
18-
</license>
19-
</licenses>
7+
<groupId>com.uber</groupId>
8+
<artifactId>cadence-flow-samples</artifactId>
9+
<name>Samples for Cadence. Based on samples for AWS SWF</name>
10+
<version>0.0.1</version>
11+
<description>This artifact contains the Cadence Service Samples</description>
12+
<url>https://github.com/aws/aws-swf-flow-library</url>
13+
<licenses>
14+
<license>
15+
<name>Apache License, Version 2.0</name>
16+
<url>https://aws.amazon.com/apache2.0</url>
17+
<distribution>repo</distribution>
18+
</license>
19+
</licenses>
2020

21-
<properties>
22-
<source.dir>src</source.dir>
21+
<properties>
22+
<source.dir>src</source.dir>
23+
<java.version>1.8</java.version>
24+
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
25+
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
26+
<maven.compiler.source>1.8</maven.compiler.source>
27+
<maven.compiler.target>1.8</maven.compiler.target>
28+
<aws.java.sdk.version>1.11.274</aws.java.sdk.version>
29+
</properties>
2330

24-
<java.version>1.8</java.version>
31+
<dependencies>
32+
<dependency>
33+
<groupId>com.uber</groupId>
34+
<artifactId>cadence-client</artifactId>
35+
<version>0.1.0</version>
36+
</dependency>
37+
<dependency>
38+
<groupId>com.amazonaws</groupId>
39+
<artifactId>aws-java-sdk-s3</artifactId>
40+
<version>${aws.java.sdk.version}</version>
41+
</dependency>
42+
<dependency>
43+
<groupId>commons-configuration</groupId>
44+
<artifactId>commons-configuration</artifactId>
45+
<version>1.9</version>
46+
</dependency>
47+
<dependency>
48+
<groupId>log4j</groupId>
49+
<artifactId>log4j</artifactId>
50+
<version>1.2.17</version>
51+
</dependency>
52+
</dependencies>
2553

26-
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
27-
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
28-
29-
<aspectj.version>1.8.11</aspectj.version>
30-
31-
<maven.compiler.source>1.8</maven.compiler.source>
32-
<maven.compiler.target>1.8</maven.compiler.target>
33-
<aws.java.sdk.version>1.11.274</aws.java.sdk.version>
34-
<freemarker.version>2.3.21</freemarker.version>
35-
<spring.version>3.0.7.RELEASE</spring.version>
36-
</properties>
37-
38-
<dependencies>
39-
<dependency>
40-
<groupId>com.uber</groupId>
41-
<artifactId>cadence-client</artifactId>
42-
<version>0.1.0</version>
43-
</dependency>
44-
<dependency>
45-
<groupId>com.amazonaws</groupId>
46-
<artifactId>aws-java-sdk-s3</artifactId>
47-
<version>${aws.java.sdk.version}</version>
48-
</dependency>
49-
50-
<dependency>
51-
<groupId>org.aspectj</groupId>
52-
<artifactId>aspectjrt</artifactId>
53-
<version>${aspectj.version}</version>
54-
</dependency>
55-
<dependency>
56-
<groupId>junit</groupId>
57-
<artifactId>junit</artifactId>
58-
<version>4.12</version>
59-
</dependency>
60-
<dependency>
61-
<groupId>commons-configuration</groupId>
62-
<artifactId>commons-configuration</artifactId>
63-
<version>1.9</version>
64-
</dependency>
65-
<dependency>
66-
<groupId>org.freemarker</groupId>
67-
<artifactId>freemarker</artifactId>
68-
<version>${freemarker.version}</version>
69-
</dependency>
70-
<dependency>
71-
<groupId>org.springframework</groupId>
72-
<artifactId>spring-beans</artifactId>
73-
<version>${spring.version}</version>
74-
<optional>true</optional>
75-
</dependency>
76-
<dependency>
77-
<groupId>org.springframework</groupId>
78-
<artifactId>spring-core</artifactId>
79-
<version>${spring.version}</version>
80-
<optional>true</optional>
81-
</dependency>
82-
<dependency>
83-
<groupId>org.springframework</groupId>
84-
<artifactId>spring-context</artifactId>
85-
<version>${spring.version}</version>
86-
<optional>true</optional>
87-
</dependency>
88-
<dependency>
89-
<groupId>org.springframework</groupId>
90-
<artifactId>spring-test</artifactId>
91-
<version>${spring.version}</version>
92-
<optional>true</optional>
93-
</dependency>
94-
<dependency>
95-
<groupId>log4j</groupId>
96-
<artifactId>log4j</artifactId>
97-
<version>1.2.17</version>
98-
</dependency>
99-
</dependencies>
100-
101-
<build>
102-
<resources>
103-
<resource>
104-
<directory>src/test/java</directory>
105-
<includes>
106-
<include>**/*.xml</include>
107-
</includes>
108-
</resource>
109-
</resources>
110-
<plugins>
111-
<plugin>
112-
<groupId>org.apache.maven.plugins</groupId>
113-
<artifactId>maven-compiler-plugin</artifactId>
114-
<version>3.2</version>
115-
<configuration>
116-
<!--compilerArgument>-proc:none</compilerArgument-->
117-
<compilerVersion>${java.version}</compilerVersion>
118-
<source>${java.version}</source>
119-
<target>${java.version}</target>
120-
</configuration>
121-
</plugin>
122-
</plugins>
123-
</build>
54+
<build>
55+
<plugins>
56+
<plugin>
57+
<groupId>org.apache.maven.plugins</groupId>
58+
<artifactId>maven-compiler-plugin</artifactId>
59+
<version>3.7.0</version>
60+
<configuration>
61+
<!--compilerArgument>-proc:none</compilerArgument-->
62+
<compilerVersion>${java.version}</compilerVersion>
63+
<source>${java.version}</source>
64+
<target>${java.version}</target>
65+
</configuration>
66+
</plugin>
67+
</plugins>
68+
</build>
12469
</project>

src/main/java/META-INF/aop.xml

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
</aspects>
88

99
<weaver options="-verbose">
10-
<include within="com.amazonaws.services.simpleworkflow.flow.examples..*"/>
10+
<include within="com.uber.cadence.samples..*"/>
1111
</weaver>
1212

1313
</aspectj>

src/main/java/com/uber/cadence/samples/booking/BookingActivities.java

-25
This file was deleted.

0 commit comments

Comments
 (0)