Class: AWS::Flow::WorkflowTaskPoller
- Inherits:
-
Object
- Object
- AWS::Flow::WorkflowTaskPoller
- Defined in:
- lib/aws/decider/task_poller.rb
Instance Method Summary collapse
-
#get_decision_task ⇒ Object
private
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) end |
Instance Method Details
#get_decision_task ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Retrieves any decision tasks that are ready.
54 55 56 |
# File 'lib/aws/decider/task_poller.rb', line 54 def get_decision_task @domain.decision_tasks.poll_for_single_task(@task_list) end |
#poll_and_process_single_task ⇒ Object
58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 |
# File 'lib/aws/decider/task_poller.rb', line 58 def poll_and_process_single_task # TODO waitIfSuspended begin @logger.debug "Polling for a new decision task of type #{@handler.workflow_definition_map.keys.map{ |x| "#{x.name} #{x.version}"} } on task_list: #{@task_list}" task = get_decision_task if task.nil? @logger.debug "Didn't get a task on task_list: #{@task_list}" return false end @logger.info Utilities.workflow_task_to_debug_string("Got decision task", task) task_completed_request = @handler.handle_decision_task(task) @logger.debug "Response to the task will be #{task_completed_request}" 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) @logger.info Utilities.workflow_task_to_debug_string("Finished executing task", task) rescue AWS::SimpleWorkflow::Errors::UnknownResourceFault => e @logger.error "Error in the poller, #{e.class}, #{e}" rescue Exception => e @logger.error "Error in the poller, #{e.class}, #{e}" end end |