Registering a Domain

To register a domain with the AWS Flow Framework for Ruby, use the underlying AWS SDK for Ruby. When you register a domain, you must provide Amazon SWF with the domain's name and retention period, measured in days. The retention period is the number of days that workflow execution history will be retained for closed workflows.

Here's a typical method that either retrieves an existing domain, or registers it if the domain name has not yet been registered:

require 'aws/decider'

# get a SWF object from the AWS Ruby SDK.
swf = AWS::SimpleWorkflow.new

# attempt to retrieve a domain. If it doesn't already exist, then register it.
domain = swf.domains['ExampleDomain']
unless domain.exists?
  domain = swf.domains.create('ExampleDomain', 10)
end

You can also use the aws-flow-ruby utility to register a domain—if you specify a domain in its worker configuration file that doesn't yet exist, the AWS Flow Framework for Ruby will attempt to register it for you.

Note

When using the AWS Flow Framework for Ruby, registering a domain is optional. If you don't declare a domain to use for your workflows, the framework will use the default domain, FlowDefault, with a retention period of 7 days.

For more information about registering domains with the AWS SDK for Ruby, see SWF::Client#register_domain in the AWS SDK for Ruby Reference.

Deprecating a Registered Domain#

If you have registered a domain name and you would like to stop any new workflows from being created in it, you can deprecate a registered domain. However, once you deprecate a domain:

  • You can no longer run any workflows within it.
  • You cannot re-register the domain within the same region and using the same account as the deprecated domain.

Given these caveats, you can deprecate a domain by using the AWS::SimpleWorkflow::Client#deprecate_domain method:

require 'aws/decider'

# get a SWF object from the AWS Ruby SDK.
swf = AWS::SimpleWorkflow.new

# deprecate the domain
swf.client.deprecate_domain({ name: 'ExampleDomain' })