Class: Vx::Lib::Consumer::Params

Inherits:
Struct
  • Object
show all
Defined in:
lib/vx/lib/consumer/params.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#ackObject

Returns the value of attribute ack.



10
11
12
# File 'lib/vx/lib/consumer/params.rb', line 10

def ack
  @ack
end

#consumer_classObject

Returns the value of attribute consumer_class

Returns:

  • (Object)

    the current value of consumer_class



4
5
6
# File 'lib/vx/lib/consumer/params.rb', line 4

def consumer_class
  @consumer_class
end

#content_typeObject

Returns the value of attribute content_type.



9
10
11
# File 'lib/vx/lib/consumer/params.rb', line 9

def content_type
  @content_type
end

#exchange_nameObject

Returns the value of attribute exchange_name.



6
7
8
# File 'lib/vx/lib/consumer/params.rb', line 6

def exchange_name
  @exchange_name
end

#exchange_optionsObject

Returns the value of attribute exchange_options.



6
7
8
# File 'lib/vx/lib/consumer/params.rb', line 6

def exchange_options
  @exchange_options
end

#exchange_typeObject

Returns the value of attribute exchange_type.



11
12
13
# File 'lib/vx/lib/consumer/params.rb', line 11

def exchange_type
  @exchange_type
end

#headersObject

Returns the value of attribute headers.



8
9
10
# File 'lib/vx/lib/consumer/params.rb', line 8

def headers
  @headers
end

#modelObject

Returns the value of attribute model.



12
13
14
# File 'lib/vx/lib/consumer/params.rb', line 12

def model
  @model
end

#queue_nameObject

Returns the value of attribute queue_name.



7
8
9
# File 'lib/vx/lib/consumer/params.rb', line 7

def queue_name
  @queue_name
end

#queue_optionsObject

Returns the value of attribute queue_options.



7
8
9
# File 'lib/vx/lib/consumer/params.rb', line 7

def queue_options
  @queue_options
end

#routing_keyObject

Returns the value of attribute routing_key.



8
9
10
# File 'lib/vx/lib/consumer/params.rb', line 8

def routing_key
  @routing_key
end

Instance Method Details

#bind_optionsObject



46
47
48
49
50
51
# File 'lib/vx/lib/consumer/params.rb', line 46

def bind_options
  opts = { }
  opts.merge!(routing_key: routing_key) if routing_key
  opts.merge!(headers: headers) if headers
  opts
end

#consumer_idObject



57
58
59
60
61
62
63
64
65
# File 'lib/vx/lib/consumer/params.rb', line 57

def consumer_id
  @consumer_id ||=
    consumer_name.gsub(/::/, '/').
      gsub(/([A-Z]+)([A-Z][a-z])/,'\1_\2').
      gsub(/([a-z\d])([A-Z])/,'\1_\2').
      tr("-", "_").
      downcase.
      gsub("_consumer$", '')
end

#consumer_nameObject



53
54
55
# File 'lib/vx/lib/consumer/params.rb', line 53

def consumer_name
  @consumer_name ||= consumer_class.to_s
end

#publish_optionsObject



42
43
44
# File 'lib/vx/lib/consumer/params.rb', line 42

def publish_options
  config.default_publish_options
end