Module: SWF
- Extended by:
- SWF
- Included in:
- SWF
- Defined in:
- lib/swf/swf.rb,
lib/swf/boot.rb,
lib/swf/runner.rb,
lib/swf/workflows.rb,
lib/swf/task_handler.rb,
lib/swf/activity_task_handler.rb,
lib/swf/decision_task_handler.rb
Defined Under Namespace
Modules: Boot, TaskHandler, Workflows
Classes: ActivityTaskHandler, DecisionTaskHandler, MissingWorkflowStartedEvent, Runner, UndefinedDomainName, UndefinedTaskList, UnknownSWFDomain
Constant Summary
collapse
- SLOT_TIME =
1
Instance Method Summary
collapse
Instance Method Details
#domain ⇒ Object
40
41
42
43
44
|
# File 'lib/swf/swf.rb', line 40
def domain
raise UnknownSWFDomain, "#{domain_name} is not a valid SWF domain" unless domain_exists?(domain_name)
swf.domains[domain_name]
end
|
#domain_exists?(d) ⇒ Boolean
28
29
30
31
32
33
34
35
36
37
38
|
# File 'lib/swf/swf.rb', line 28
def domain_exists?(d)
collision = 0
begin
swf.domains[d].exists?
rescue => e
collision += 1 if collision < 10
max_slot_delay = 2**collision - 1
sleep(SLOT_TIME * rand(0 .. max_slot_delay))
retry
end
end
|
#domain_name ⇒ Object
15
16
17
18
|
# File 'lib/swf/swf.rb', line 15
def domain_name
raise UndefinedDomainName, "domain name not defined" unless @domain_name
@domain_name
end
|
#domain_name=(d) ⇒ Object
in the runner context, where domain_name comes from ENV settings we call SWF.domain_name = MyApp::Settings.swf_domain
22
23
24
|
# File 'lib/swf/swf.rb', line 22
def domain_name=(d)
@domain_name = d
end
|
#swf ⇒ Object
11
12
13
|
# File 'lib/swf/swf.rb', line 11
def swf
@swf ||= AWS::SimpleWorkflow.new
end
|
#task_list ⇒ Object
50
51
52
|
# File 'lib/swf/swf.rb', line 50
def task_list
@task_list or raise UndefinedTaskList, "task_list must be defined via SWF.task_list = <task_list>"
end
|
#task_list=(tl) ⇒ Object
46
47
48
|
# File 'lib/swf/swf.rb', line 46
def task_list=(tl)
@task_list = tl
end
|