A starter Maven project for learning the Amazon Flow Framework for Java. This project downloads an image from S3 to an Activity Worker. The Activity Worker zips the file and uploads it back to S3 when complete.
A more detailed explanation of this code is available on my website.
Adapted from https://github.com/aws/aws-sdk-java/tree/master/src/samples/AwsFlowFramework
Flow framework has dependencies on annotation processing (Java 1.6 and up)
and AspectJ. To get these working for Maven and IntelliJ requires some
configuration. A lot of the steps to get this working I adapted from this
stackoverflow
thread;
things should work using the pom.xml
file present in this repo and, if
not, that thread has excellent troubleshooting information.
You can verify the dependencies are correct by using Maven to compile the code and checking for auto-generated classes.
> # compile annotations and aspects
> mvn verify
> # grep for auto-generated aspect classes
> find target/classes -type f | grep Ajc
Activity and Workflow Workers can be run locally or on remote hosts.
- Create an S3 bucket for hosting the image files.
- Upload an image to the bucket.
- Create an SWF Domain to run your workflow through the AWS UI.
- Update the
src/main/resources/processor.properties
file with your S3 and SWF configuration. - A valid AWS credentials file located at
~/.aws/credentials
These commands can be run locally or on remote hosts, depending on your deployment.
Using Maven:
> mvn -e compile exec:java -Dexec.mainClass=com.sookocheff.swf.processor.ActivityHost
> mvn -e compile exec:java -Dexec.mainClass=com.sookocheff.swf.processor.WorkflowHost
From the bundled Jar file:
> mvn package
> java -cp target/swf-starter-bundled-1.0-SNAPSHOT.jar com.sookocheff.swf.processor.ActivityHost
> java -cp target/swf-starter-bundled-1.0-SNAPSHOT.jar com.sookocheff.swf.processor.WorkflowHost
An execution of the workflow can be started via the SWF UI or through the
included WorkflowExecutionStarter
application.
Using Maven:
> mvn -e compile exec:java -Dexec.mainClass=com.sookocheff.swf.processor.WorkflowExecutionStarter
From the bundled Jar file:
> mvn package
> java -cp target/swf-starter-bundled-1.0-SNAPSHOT.jar com.sookocheff.swf.processor.WorkflowExecutionStarter