User guide

Programming Amazon SWF with the AWS SDK
for Java
This section provides information specific to programming Amazon SWF with the SDK for Java.
Topics
Registering an Amazon SWF Domain Using the AWS SDK for Java (p. 63)
Listing Amazon SWF Domains Using the AWS SDK for Java (p. 63)
Registering an Amazon SWF Domain Using the
AWS SDK for Java
Every workflow and activity in Amazon SWF needs a domain to run in.
To register an Amazon SWF domain
1. Create a new RegisterDomainRequest object, providing it with at least the domain name and workflow
execution retention period (these parameters are both required).
2. Call the AmazonSimpleWorkflowClient.registerDomain method with the RegisterDomainRequest
object.
3. Catch the DomainAlreadyExistsException if the domain you're requesting already exists (in which
case, no action is usually required).
The following code demonstrates this procedure:
public void register_swf_domain(AmazonSimpleWorkflowClient swf, String name)
{
RegisterDomainRequest request = new RegisterDomainRequest().withName(name);
request.setWorkflowExecutionRetentionPeriodInDays("10");
try
{
swf.registerDomain(request);
}
catch (DomainAlreadyExistsException e)
{
System.out.println("Domain already exists!");
}
}
Listing Amazon SWF Domains Using the AWS SDK
for Java
You can list the Amazon SWF domains associated with your account and AWS region by registration
type.
Version v1.0.0
63
AWS SDK for Java Developer Guide
Amazon SWF