Class: ApplicationProcessor
- Inherits:
-
ActiveMessaging::Processor
- Object
- ActiveMessaging::Processor
- ApplicationProcessor
- Defined in:
- lib/generators/active_messaging/install/templates/application_processor.rb
Instance Attribute Summary
Attributes inherited from ActiveMessaging::Processor
Instance Method Summary collapse
-
#on_error(err) ⇒ Object
Default on_error implementation - logs standard errors but keeps processing.
Methods inherited from ActiveMessaging::Processor
#logger, #on_message, #process!, subscribes_to
Methods included from ActiveMessaging::MessageSender
included, #publish, #publish_with_reset, #receive
Instance Method Details
#on_error(err) ⇒ Object
Default on_error implementation - logs standard errors but keeps processing. Other exceptions are raised. Have on_error throw ActiveMessaging::AbortMessageException when you want a message to be aborted/rolled back, meaning that it can and should be retried (idempotency matters here). Retry logic varies by broker - see individual adapter code and docs for how it will be treated
7 8 9 10 11 12 13 14 15 16 |
# File 'lib/generators/active_messaging/install/templates/application_processor.rb', line 7 def on_error(err) if (err.kind_of?(StandardError)) logger.error "ApplicationProcessor::on_error: #{err.class.name} rescued:\n" + \ err. + "\n" + \ "\t" + err.backtrace.join("\n\t") else logger.error "ApplicationProcessor::on_error: #{err.class.name} raised: " + err. raise err end end |