mirror of
https://github.com/ditkrg/rabbit_carrots.git
synced 2026-01-23 06:16:39 +00:00
Adds automatic recovery and exit strategy
This commit is contained in:
parent
876a48a1ab
commit
28b620b7b4
@ -9,6 +9,15 @@ module RabbitCarrots
|
|||||||
end
|
end
|
||||||
|
|
||||||
class Configuration
|
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
|
||||||
end
|
end
|
||||||
|
|||||||
@ -11,7 +11,11 @@ module RabbitCarrots
|
|||||||
port: RabbitCarrots.configuration.rabbitmq_port,
|
port: RabbitCarrots.configuration.rabbitmq_port,
|
||||||
user: RabbitCarrots.configuration.rabbitmq_user,
|
user: RabbitCarrots.configuration.rabbitmq_user,
|
||||||
password: RabbitCarrots.configuration.rabbitmq_password,
|
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
|
@connection.start
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user