lib/tobox/configuration.rb in tobox-0.1.6 vs lib/tobox/configuration.rb in tobox-0.2.0
- old
+ new
@@ -15,10 +15,11 @@
environment: ENV.fetch("APP_ENV", "development"),
logger: nil,
log_level: nil,
database_uri: nil,
table: :outbox,
+ group_column: nil,
max_attempts: 10,
exponential_retry_factor: 4,
wait_for_events_delay: 5,
shutdown_timeout: 10,
concurrency: 4, # TODO: CPU count
@@ -58,12 +59,14 @@
@default_logger.level = @config[:log_level] || (env == "production" ? Logger::INFO : Logger::DEBUG)
freeze
end
- def on(event, &callback)
- (@handlers[event.to_sym] ||= []) << callback
+ def on(*events, &callback)
+ events.each do |event|
+ (@handlers[event.to_sym] ||= []) << callback
+ end
self
end
def on_before_event(&callback)
(@lifecycle_events[:before_event] ||= []) << callback
@@ -75,9 +78,14 @@
self
end
def on_error_event(&callback)
(@lifecycle_events[:error_event] ||= []) << callback
+ self
+ end
+
+ def on_error_worker(&callback)
+ (@lifecycle_events[:error_worker] ||= []) << callback
self
end
def message_to_arguments(&callback)
@arguments_handler = callback