Class: Hermes::ProducerErrorHandler::SafeHandler
- Inherits:
-
Object
- Object
- Hermes::ProducerErrorHandler::SafeHandler
- Defined in:
- lib/hermes/producer_error_handler/safe_handler.rb
Instance Method Summary collapse
- #call(event) ⇒ Object
-
#initialize(job_class:, error_notifier:, retryable:) ⇒ SafeHandler
constructor
A new instance of SafeHandler.
Constructor Details
#initialize(job_class:, error_notifier:, retryable:) ⇒ SafeHandler
Returns a new instance of SafeHandler.
7 8 9 10 11 |
# File 'lib/hermes/producer_error_handler/safe_handler.rb', line 7 def initialize(job_class:, error_notifier:, retryable:) @job_class = job_class @error_notifier = error_notifier @retryable = retryable end |
Instance Method Details
#call(event) ⇒ Object
13 14 15 16 17 18 |
# File 'lib/hermes/producer_error_handler/safe_handler.rb', line 13 def call(event) retryable.perform { yield } rescue => error error_notifier.capture_exception(error) job_class.enqueue(event.class.name, event.as_json, event.origin_headers) end |