Registering Domains - Amazon SDK for Java 1.x
Services or capabilities described in Amazon Web Services documentation might vary by Region. To see the differences applicable to the China Regions, see Getting Started with Amazon Web Services in China (PDF).

The Amazon SDK for Java 1.x has entered maintenance mode as of July 31, 2024, and will reach end-of-support on December 31, 2025. We recommend that you migrate to the Amazon SDK for Java 2.x to continue receiving new features, availability improvements, and security updates.

Registering Domains

Every workflow and activity in Amazon SWF needs a domain to run in.

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