Skip to content

basement-io/hutch-error-handlers-reconnect-active-record

Repository files navigation

What it does

It provides a handler that will attempt to reconnect the Active Record with the database.

Whenever the database is reset while the hutch process is alive, the connection is not re-established like in a Rails application, so add this a handler to your hutch configuration.

Messages that get the error will still be nacked by hutch, you will need to add code to your application to requeue your messsages if you want.

Configuring

On your hutch initializer

require 'hutch/error_handlers/reconnect_active_record'

Hutch::Config.set(:error_handlers, [
  Hutch::ErrorHandlers::Logger.new, Hutch::ErrorHandlers::ReconnectActiveRecord.new
])

or if you just want to add the handler after some other configurations

require 'hutch/error_handlers/reconnect_active_record'

Hutch::Config[:error_handlers] << Hutch::ErrorHandlers::ReconnectActiveRecord.new

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages