Class: AWS::Flow::WorkflowTaskPoller
- Inherits:
-
Object
- Object
- AWS::Flow::WorkflowTaskPoller
- Defined in:
- lib/aws/decider/task_poller.rb
Instance Method Summary collapse
-
#get_decision_tasks ⇒ Object
Retrieves any decision tasks that are ready.
-
#initialize(service, domain, handler, task_list, options = nil) ⇒ WorkflowTaskPoller
constructor
Creates a new WorkflowTaskPoller.
- #poll_and_process_single_task ⇒ Object
Constructor Details
#initialize(service, domain, handler, task_list, options = nil) ⇒ WorkflowTaskPoller
Creates a new WorkflowTaskPoller
41 42 43 44 45 46 47 48 |
# File 'lib/aws/decider/task_poller.rb', line 41 def initialize(service, domain, handler, task_list, =nil) @service = service @handler = handler @domain = domain @task_list = task_list @logger = .logger if @logger ||= Utilities::LogFactory.make_logger(self, "debug") end |
Instance Method Details
#get_decision_tasks ⇒ Object
Retrieves any decision tasks that are ready.
53 54 55 |
# File 'lib/aws/decider/task_poller.rb', line 53 def get_decision_tasks @domain.decision_tasks.poll_for_single_task(@task_list) end |
#poll_and_process_single_task ⇒ Object
57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 |
# File 'lib/aws/decider/task_poller.rb', line 57 def poll_and_process_single_task # TODO waitIfSuspended begin @logger.debug "Starting a new task...\n\n\n" tasks = get_decision_tasks return false if tasks.nil? @logger.debug "We have this many tasks #{tasks}" @logger.debug "debugging on #{tasks}\n" task_completed_request = @handler.handle_decision_task(tasks) @logger.debug "task to be responded to with #{task_completed_request}\n" if !task_completed_request[:decisions].empty? && (task_completed_request[:decisions].first.keys.include?(:fail_workflow_execution_decision_attributes)) fail_hash = task_completed_request[:decisions].first[:fail_workflow_execution_decision_attributes] reason = fail_hash[:reason] details = fail_hash[:details] @logger.debug "#{reason}, #{details}" end @service.respond_decision_task_completed(task_completed_request) rescue AWS::SimpleWorkflow::Errors::UnknownResourceFault => e @logger.debug "Error in the poller, #{e}" @logger.debug "The error class in #{e.class}" rescue Exception => e @logger.debug "Error in the poller, #{e}" end end |