Class: FrenzyBunnies::QueueFactory
- Inherits:
-
Object
- Object
- FrenzyBunnies::QueueFactory
- Defined in:
- lib/frenzy_bunnies/queue_factory.rb
Instance Method Summary collapse
- #build_queue(name, prefetch, durable) ⇒ Object
-
#initialize(connection, exchange) ⇒ QueueFactory
constructor
A new instance of QueueFactory.
Constructor Details
#initialize(connection, exchange) ⇒ QueueFactory
Returns a new instance of QueueFactory.
2 3 4 5 |
# File 'lib/frenzy_bunnies/queue_factory.rb', line 2 def initialize(connection, exchange) @connection = connection @exchange = exchange end |
Instance Method Details
#build_queue(name, prefetch, durable) ⇒ Object
7 8 9 10 11 12 13 14 15 16 |
# File 'lib/frenzy_bunnies/queue_factory.rb', line 7 def build_queue(name, prefetch, durable) channel = @connection.create_channel channel.prefetch = prefetch exchange = channel.exchange(@exchange, :type => :direct, :durable => durable) queue = channel.queue(name, :durable => durable) queue.bind(exchange, :routing_key => name) queue end |