Class: ConsulKvBackup::Amqp
- Inherits:
-
Object
- Object
- ConsulKvBackup::Amqp
- Includes:
- FlazmRubyHelpers::Class
- Defined in:
- lib/consul_kv_backup/amqp.rb
Overview
Send diff output to jq command line
Instance Attribute Summary collapse
-
#consul ⇒ Object
Returns the value of attribute consul.
-
#git ⇒ Object
Returns the value of attribute git.
Instance Method Summary collapse
- #consume ⇒ Object
-
#initialize(amqp_config) ⇒ Amqp
constructor
A new instance of Amqp.
- #setup_connection ⇒ Object
Constructor Details
#initialize(amqp_config) ⇒ Amqp
Returns a new instance of Amqp.
13 14 15 16 |
# File 'lib/consul_kv_backup/amqp.rb', line 13 def initialize(amqp_config) initialize_variables(amqp_config) setup_connection end |
Instance Attribute Details
#consul ⇒ Object
Returns the value of attribute consul.
12 13 14 |
# File 'lib/consul_kv_backup/amqp.rb', line 12 def consul @consul end |
#git ⇒ Object
Returns the value of attribute git.
12 13 14 |
# File 'lib/consul_kv_backup/amqp.rb', line 12 def git @git end |
Instance Method Details
#consume ⇒ Object
30 31 32 33 |
# File 'lib/consul_kv_backup/amqp.rb', line 30 def consume @consumer ||= @queue.subscribe(block: true, &itself.method(:process_message)) nil end |
#setup_connection ⇒ Object
18 19 20 21 22 23 24 25 26 27 28 |
# File 'lib/consul_kv_backup/amqp.rb', line 18 def setup_connection @conn = Bunny.new(amqp_opts) @conn.start @ch = @conn.create_channel @ex = Bunny::Exchange.new(@ch, :topic, @amqp_exchange, durable: true) @queue = @ch.queue(@amqp_queue, durable: true) @queue.bind(@ex, routing_key: @amqp_routing_key) if @amqp_bind end |