Module: Camunda::ExternalTaskJob
- Included in:
- CamundaJob
- Defined in:
- lib/camunda/external_task_job.rb
Instance Method Summary collapse
- #bpmn_perform(_variables) ⇒ Object
- #perform(id, input_variables) ⇒ Object
- #report_bpmn_error(id, exception) ⇒ Object
- #report_completion(id, variables) ⇒ Object
- #report_failure(id, exception, input_variables) ⇒ Object
Instance Method Details
#bpmn_perform(_variables) ⇒ Object
32 33 34 |
# File 'lib/camunda/external_task_job.rb', line 32 def bpmn_perform(_variables) raise StandardError, "Please define this method which takes a hash of variables and returns a hash of variables" end |
#perform(id, input_variables) ⇒ Object
2 3 4 5 6 7 8 9 10 11 12 |
# File 'lib/camunda/external_task_job.rb', line 2 def perform(id, input_variables) output_variables = bpmn_perform(input_variables) output_variables = {} if output_variables.nil? raise ArgumentError, "Expected a hash, got #{output_variables}" unless output_variables.is_a?(Hash) report_completion id, output_variables rescue Camunda::BpmnError => e report_bpmn_error id, e rescue StandardError => e report_failure id, e, input_variables end |
#report_bpmn_error(id, exception) ⇒ Object
26 27 28 29 30 |
# File 'lib/camunda/external_task_job.rb', line 26 def report_bpmn_error(id, exception) # Submit bpmn error state to Camunda using # POST /external-task/{id}/bpmnError Camunda::ExternalTask.new(id: id).bpmn_error(exception) end |
#report_completion(id, variables) ⇒ Object
14 15 16 17 18 |
# File 'lib/camunda/external_task_job.rb', line 14 def report_completion(id, variables) # Submit to Camunda using # POST /external-task/{id}/complete Camunda::ExternalTask.new(id: id).complete(variables) end |
#report_failure(id, exception, input_variables) ⇒ Object
20 21 22 23 24 |
# File 'lib/camunda/external_task_job.rb', line 20 def report_failure(id, exception, input_variables) # Submit error state to Camunda using # POST /external-task/{id}/failure Camunda::ExternalTask.new(id: id).failure(exception, input_variables) end |