Class: Smith::Messaging::AmqpOptions

Inherits:
Object
  • Object
show all
Includes:
Logger
Defined in:
lib/smith/messaging/amqp_options.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from Logger

included

Constructor Details

#initialize(options = {}) ⇒ AmqpOptions

Returns a new instance of AmqpOptions.



9
10
11
12
# File 'lib/smith/messaging/amqp_options.rb', line 9

def initialize(options={})
  @options = options
  @options_map = {:strict => {:immediate => true, :mandatory => true}}
end

Instance Attribute Details

#routing_keyObject

Returns the value of attribute routing_key.



7
8
9
# File 'lib/smith/messaging/amqp_options.rb', line 7

def routing_key
  @routing_key
end

Instance Method Details

#exchange(*extra_opts) ⇒ Object



14
15
16
# File 'lib/smith/messaging/amqp_options.rb', line 14

def exchange(*extra_opts)
  merge(Smith.config.amqp.exchange.to_hash, @options, extra_opts)
end

#pop(*extra_opts) ⇒ Object



22
23
24
# File 'lib/smith/messaging/amqp_options.rb', line 22

def pop(*extra_opts)
  merge(Smith.config.amqp.pop.to_hash, @options, extra_opts)
end

#publish(*extra_opts) ⇒ Object



26
27
28
# File 'lib/smith/messaging/amqp_options.rb', line 26

def publish(*extra_opts)
  merge(Smith.config.amqp.publish.to_hash, {:routing_key => routing_key, :persistent => true}, extra_opts)
end

#queue(*extra_opts) ⇒ Object



18
19
20
# File 'lib/smith/messaging/amqp_options.rb', line 18

def queue(*extra_opts)
  merge(Smith.config.amqp.queue.to_hash, @options, extra_opts)
end

#subscribe(*extra_opts) ⇒ Object



30
31
32
# File 'lib/smith/messaging/amqp_options.rb', line 30

def subscribe(*extra_opts)
  merge(Smith.config.amqp.subscribe.to_hash, extra_opts)
end