module Batsir::AMQP

Attributes

durable[RW]
exchange[RW]
heartbeat[RW]
host[RW]
password[RW]
port[RW]
queue[RW]
username[RW]
vhost[RW]

Public Instance Methods

bunny_options() click to toggle source
# File lib/batsir/amqp.rb, line 13
def bunny_options
  {
    :host  => host,
    :port  => port,
    :user  => username,
    :pass  => password,
    :vhost => vhost,
    :heartbeat => heartbeat
  }
end
bunny_pool() click to toggle source
# File lib/batsir/amqp.rb, line 64
def bunny_pool
  @bunny_pool = Batsir::Registry.get(bunny_pool_key)
  if !@bunny_pool
    pool = ConnectionPool.new(:size => bunny_pool_size) { Bunny.new(bunny_options).start }
    @bunny_pool = Batsir::Registry.register(bunny_pool_key, pool)
  end
  @bunny_pool
end
bunny_pool_key() click to toggle source
# File lib/batsir/amqp.rb, line 60
def bunny_pool_key
  "bunny_pool_for_#{host}_#{port}_#{vhost}"
end
bunny_pool_size() click to toggle source
# File lib/batsir/amqp.rb, line 52
def bunny_pool_size
  @bunny_pool_size ||= Batsir::Config.ampq_pool_size
end