Module: Evrone::Common::AMQP::Consumer::Subscribe

Included in:
ClassMethods
Defined in:
lib/evrone/common/amqp/consumer/subscribe.rb

Instance Method Summary collapse

Instance Method Details

#subscribeObject



6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
# File 'lib/evrone/common/amqp/consumer/subscribe.rb', line 6

def subscribe
  session.open

  session.with_channel do
    x = declare_exchange
    q = declare_queue

    run_callbacks(:subscribe, exchange: x, queue: q, name: consumer_name) do
      debug "subscribing to #{q.name}:#{x.name} using #{bind_options.inspect}"
      q.bind(x, bind_options)
      debug "successfuly subscribed to #{q.name}:#{x.name}"

      subscription_loop q
    end

    debug "shutdown"
  end
end