Class: PatientHttp::TaskHandler Abstract
- Inherits:
-
Object
- Object
- PatientHttp::TaskHandler
- Defined in:
- lib/patient_http/task_handler.rb
Overview
Subclass and implement all methods to create a concrete handler.
Abstract base class for handling task lifecycle operations.
TaskHandler abstracts the job system integration, allowing RequestTask to work with any job system without direct dependencies. Implementations handle completion callbacks, error callbacks, and job retry operations.
Instance Method Summary collapse
-
#on_complete(response, callback) ⇒ void
Trigger the completion callback with the response.
-
#on_error(error, callback) ⇒ void
Trigger the error callback with the error.
-
#retry ⇒ String
Re-enqueue the original job for retry.
Instance Method Details
#on_complete(response, callback) ⇒ void
This method returns an undefined value.
Trigger the completion callback with the response.
32 33 34 |
# File 'lib/patient_http/task_handler.rb', line 32 def on_complete(response, callback) raise NotImplementedError, "#{self.class}#on_complete must be implemented" end |
#on_error(error, callback) ⇒ void
This method returns an undefined value.
Trigger the error callback with the error.
41 42 43 |
# File 'lib/patient_http/task_handler.rb', line 41 def on_error(error, callback) raise NotImplementedError, "#{self.class}#on_error must be implemented" end |
#retry ⇒ String
Re-enqueue the original job for retry.
Called when a request cannot be completed (e.g., processor shutdown) and needs to be retried later.
51 52 53 |
# File 'lib/patient_http/task_handler.rb', line 51 def retry raise NotImplementedError, "#{self.class}#retry must be implemented" end |