The AWS Flow Framework for Java is included with the AWS SDK for Java. This topic provides instructions about how to set up the framework with the AWS Toolkit for Eclipse, which can install the SDK for Java for you and is the easiest way to use the framework if you use Eclipse.
Installing the Toolkit for Eclipse is the simplest way to get started with the AWS Flow Framework for Java. To install the Toolkit for Eclipse, see Setting Up the AWS Toolkit for Eclipse in the AWS Toolkit for Eclipse Getting Started Guide.
Be sure to include both the AWS SDK for Java and AWS Simple Workflow Tools when selecting which packages to install in Eclipse's Available Software dialog box:
If you installed all of the available packages (by clicking the AWS Toolkit for Eclipse top-level node, or clicking Select All), both of these packages were automatically selected and installed for you.
Creating a properly configured AWS Flow Framework for Java project in Eclipse involves a number of steps:
Create an AWS Java project.
Enable annotation processing for your project.
Enable and configure AspectJ.
Each of these steps will now be described in detail.
To create an AWS Java project
To select the Java perspective, click Window > Open Perspective > Java.
Click File > New > AWS Java Project.
Use the AWS Java project wizard to create a new project.
The first time you create an AWS Java project with Eclipse, the SDK for Java will be automatically downloaded and installed when the project wizard starts.
After creating your AWS Java project, enable annotation processing for the project. The AWS Flow Framework for Java includes an annotation processor that generates several key classes based on annotated source code.
To enable annotation processing
In Project Explorer, right-click your project and select Properties.
In the Properties dialog box, navigate to Java Compiler > Annotation Processing.
Check Enable project specific settings (which should also Enable annotation processing, but if it doesn't make sure that this option is also checked). Then click OK.
You will need to rebuild your project after enabling annotation processing.
Next, you should enable and configure AspectJ.
Certain AWS Flow Framework for Java annotations such as
@Asynchronous require AspectJ. You don't need to use
AspectJ directly, but you must enable it with either load-time weaving or
The recommended approach is to use load-time weaving.
Before configuring AspectJ, you need the AspectJ version that matches your Java version:
If you are using Java 7 (recommended), download the latest AspectJ 1.7.X release.
If you are using Java 6, download the latest AspectJ 1.6.X release.
You can download either of these versions of AspectJ from: http://www.eclipse.org/aspectj/downloads.php.
After you have finished downloading AspectJ, execute the downloaded
.jar file to
install AspectJ. The AspectJ installation will ask you where you would like to install the binaries, and on
the final screen, will provide recommended steps for completing the installation. Remember the
location of the aspectjweaver.jar file; you'll need it to configure AspectJ in Eclipse.
To configure AspectJ load-time weaving for your AWS Flow Framework for Java project, first designate the AspectJ
JAR file as a Java agent, and then configure it by adding an
aop.xml file to your
To add AspectJ as a Java agent
To open the Preferences dialog box, click Window > Preferences.
Navigate to Java > Installed JREs.
Select the appropriate JRE and click Edit.
In the Default VM arguments box, enter the path to the installed AspectJ
binary. This will be a path such as
/home/user/aspectj1.7/lib/aspectjweaver.jar, depending on your operating system
and on the version of AspectJ you downloaded.
On Linux, OS X, or Unix use:
On Windows, use a standard Windows-style path instead:
To configure AspectJ for AWS Flow Framework for Java, add an
aop.xml file to the project.
To add an aop.xml file
In your project's src directory, add a directory named
Add a file named
META-INF with the
<aspectj> <aspects> <!-- declare two existing aspects to the weaver --> <aspect name="com.amazonaws.services.simpleworkflow.flow.aspectj.AsynchronousAspect"/> <aspect name="com.amazonaws.services.simpleworkflow.flow.aspectj.ExponentialRetryAspect"/> </aspects> <weaver options="-verbose"> <include within="<replaceable>MySimpleWorkflow.*</replaceable>"/> </weaver> </aspectj>
The value of
<include within=""/> depends on how you name your
project's packages. The above example assumes that the project's packages followed the pattern
MySimpleWorkflow.*. Use a value appropriate for your own project's
To enable and configure AspectJ compile-time weaving, you must first install the AspectJ developer tools for Eclipse, which are available from http://www.eclipse.org/aspectj/downloads.php.
To install the AspectJ Developer Tools in Eclipse
On the Help menu, click Install New Software.
In the Available Software dialog box, enter
version represents your Eclipse version number. For example, if you are using
Eclipse 4.3 (Kepler), you would enter:
Be sure that the AspectJ version matches your Eclipse version, or installation of AspectJ will fail.
Click Add to add the location. Once the location is added, the AspectJ developer tools will be listed.
Click Select All to select all of the AspectJ developer tools, then click Next to install them.
You will need to restart Eclipse to complete the installation.
You must then configure your project.
To configure your project for AspectJ compile-time weaving
In Project Explorer, right-click your project and select Configure > Convert to AspectJ Project.
The AspectJ Runtime Library will be added to your project.
Right-click your project again and click Properties.
Click AspectJ Build and then click the Aspect Path tab.
Click Add External JARs and add the add the AWS SDK for Java JAR file to your project's Aspect Path.
The AWS Toolkit for Eclipse installs the AWS SDK for Java JAR file in your workspace, in the
Version/lib directory, where you replace AWS Version
with the installed AWS SDK version number. Otherwise, you can use the JAR file that is included
with the regular AWS SDK installation, which is in the
The AspectJ Eclipse plug-in has an issue that can prevent generated code from being compiled. To work around this issue, first remove AspectJ and then re-convert your project:
Right-click your project, click AspectJ Tools > Remove AspectJ Capability, and then click Yes to confirm.
Right-click your project, click Configure > Convert to AspectJ Project.