Class: Rabbitek::Utils::Common
- Inherits:
-
Object
- Object
- Rabbitek::Utils::Common
- Defined in:
- lib/rabbitek/utils/common.rb
Overview
Common utilities to create/use RabbitMQ exchange or queue
Class Method Summary collapse
Class Method Details
.exchange(channel, exchange_type, exchange_name) ⇒ Object
9 10 11 |
# File 'lib/rabbitek/utils/common.rb', line 9 def exchange(channel, exchange_type, exchange_name) channel.public_send(exchange_type || 'direct', exchange_name, durable: true, auto_delete: false) end |
.queue(channel, name, opts) ⇒ Object
13 14 15 16 17 18 19 20 |
# File 'lib/rabbitek/utils/common.rb', line 13 def queue(channel, name, opts) opts ||= {} opts = symbolize_keys(opts.to_hash) opts[:durable] = true opts[:auto_delete] = false channel.queue(name, opts) end |