Please sign in to comment.
Merge pull request #6 from danielfarrell/topics-and-routing
Support other exchange types and routing keys
- Loading branch information...
Showing with 17 additions and 11 deletions.
|@@ -1,17 +1,22 @@|
|- def initialize(connection, exchange)|
|+ def initialize(connection)|
|@connection = connection|
|- @exchange = exchange|
|- def build_queue(name, prefetch, durable)|
|+ def build_queue(name, options)|
|+ exchange_name = options[:exchange] || 'frenzy_bunnies'|
|+ exchange_type = options[:exchange_type] || :direct|
|+ routing_key = options[:routing_key] || name|
|+ durable = options[:durable]|
|+ prefetch = options[:prefetch]|
|channel = @connection.create_channel|
|channel.prefetch = prefetch|
|- exchange = channel.exchange(@exchange, :type => :direct, :durable => durable)|
|+ exchange = channel.exchange(exchange_name, :type => exchange_type, :durable => durable)|
|queue = channel.queue(name, :durable => durable)|
|- queue.bind(exchange, :routing_key => name)|
|+ queue.bind(exchange, :routing_key => routing_key)|