diff --git a/lib/rabbit_carrots/configuration.rb b/lib/rabbit_carrots/configuration.rb index 410561a..f1e4d92 100644 --- a/lib/rabbit_carrots/configuration.rb +++ b/lib/rabbit_carrots/configuration.rb @@ -9,6 +9,15 @@ module RabbitCarrots end class Configuration - attr_accessor :rabbitmq_host, :rabbitmq_port, :rabbitmq_user, :rabbitmq_password, :rabbitmq_vhost, :routing_key_mappings, :rabbitmq_exchange_name + attr_accessor :rabbitmq_host, + :rabbitmq_port, + :rabbitmq_user, + :rabbitmq_password, + :rabbitmq_vhost, + :routing_key_mappings, + :rabbitmq_exchange_name, + :automatically_recover, + :network_recovery_interval, + :recovery_attempts end end diff --git a/lib/rabbit_carrots/connection.rb b/lib/rabbit_carrots/connection.rb index 8a1b246..81dfc95 100644 --- a/lib/rabbit_carrots/connection.rb +++ b/lib/rabbit_carrots/connection.rb @@ -11,7 +11,11 @@ module RabbitCarrots port: RabbitCarrots.configuration.rabbitmq_port, user: RabbitCarrots.configuration.rabbitmq_user, password: RabbitCarrots.configuration.rabbitmq_password, - vhost: RabbitCarrots.configuration.rabbitmq_vhost + vhost: RabbitCarrots.configuration.rabbitmq_vhost, + automatically_recover: RabbitCarrots.configuration.automatically_recover || true, + network_recovery_interval: RabbitCarrots.configuration.network_recovery_interval || 5, + recovery_attempts: RabbitCarrots.configuration.recovery_attempts || 5, + recovery_attempts_exhausted: -> { Process.kill('TERM', Process.pid) } ) @connection.start