AWS SDK for Java
Developer Guide

Registering Domains

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!"); } }