mirror of
https://github.com/ditkrg/rabbit_carrots.git
synced 2026-01-22 13:56:41 +00:00
Adds automatic recovery and exit strategy
This commit is contained in:
parent
876a48a1ab
commit
28b620b7b4
@ -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
|
||||
|
||||
@ -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
|
||||
|
||||
Loading…
Reference in New Issue
Block a user