Module: SimplerWorkflow

Extended by:
SimplerWorkflow
Included in:
SimplerWorkflow
Defined in:
lib/simpler_workflow/default_exception_reporter.rb,
lib/simpler_workflow.rb,
lib/simpler_workflow/domain.rb,
lib/simpler_workflow/version.rb,
lib/simpler_workflow/activity.rb,
lib/simpler_workflow/workflow.rb,
lib/simpler_workflow/parent_process.rb,
lib/simpler_workflow/activity_registry.rb,
lib/simpler_workflow/options_as_methods.rb

Overview

Default exception handler. Just logs to the logger and re-raise so the exception can be managed as usual.

Defined Under Namespace

Modules: OptionsAsMethods, ParentProcess Classes: Activity, ActivityRegistry, DefaultExceptionReporter, Domain, Workflow

Constant Summary collapse

VERSION =
"0.3.3"

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#after_fork(&block) ⇒ Object

Sets the code to be called after a process fork when a block is provided. Returns the previously set block (or nil) otherwise.

Parameters:

  • block

    The block that will be called after a process is forked.

Returns:

  • Proc the block that was passed earlier (or nil)



31
32
33
# File 'lib/simpler_workflow.rb', line 31

def after_fork(&block)
  block ? (@after_fork = block) : @after_fork
end

Instance Method Details

#child_processesObject

The list of child processes that have been forked from the main process.



37
38
39
# File 'lib/simpler_workflow.rb', line 37

def child_processes
  @child_processes ||= []
end

#domain(domain_name) ⇒ Object

Provides a handle to a domain.



11
12
13
14
# File 'lib/simpler_workflow.rb', line 11

def domain(domain_name)
  @domains ||= {}
  @domains[domain_name.to_sym] ||= Domain.new(domain_name)
end

#exception_reporter(&block) ⇒ Object



41
42
43
44
45
46
47
# File 'lib/simpler_workflow.rb', line 41

def exception_reporter(&block)
  if block_given?
    @exception_reporter = DefaultExceptionReporter.new(&block)
  end

  @exception_reporter || DefaultExceptionReporter.new
end

#exception_reporter=(exception_handler) ⇒ Object



49
50
51
# File 'lib/simpler_workflow.rb', line 49

def exception_reporter=(exception_handler)
  @exception_reporter = exception_handler
end

#loggerObject

The logger used. Falls back to the Rails logger.



22
23
24
# File 'lib/simpler_workflow.rb', line 22

def logger
  $logger || Rails.logger
end

#swfObject

Provides a handle to the SimpleWorkflow underlying service.



17
18
19
# File 'lib/simpler_workflow.rb', line 17

def swf
  @swf ||= ::AWS::SimpleWorkflow.new
end