Module: Vx::Lib::Consumer::ClassMethods

Defined in:
lib/vx/lib/consumer.rb

Instance Method Summary collapse

Instance Method Details

#ackObject



75
76
77
# File 'lib/vx/lib/consumer.rb', line 75

def ack
  params.ack = true
end

#allocate_pub_channelObject



87
88
89
# File 'lib/vx/lib/consumer.rb', line 87

def allocate_pub_channel
  Consumer.session.allocate_pub_channel { yield }
end

#configurationObject



91
92
93
# File 'lib/vx/lib/consumer.rb', line 91

def configuration
  Consumer.configuration
end

#content_type(value) ⇒ Object



71
72
73
# File 'lib/vx/lib/consumer.rb', line 71

def content_type(value)
  params.content_type = value
end

#directObject



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

def direct
  params.exchange_type = :direct
end

#exchange(*args) ⇒ Object



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

def exchange(*args)
  params.exchange_options = args.last.is_a?(Hash) ? args.pop : nil
  params.exchange_name    = args.first
end

#fanoutObject



46
47
48
# File 'lib/vx/lib/consumer.rb', line 46

def fanout
  params.exchange_type = :fanout
end

#headers(value) ⇒ Object



67
68
69
# File 'lib/vx/lib/consumer.rb', line 67

def headers(value)
  params.headers = value
end

#model(value) ⇒ Object



79
80
81
# File 'lib/vx/lib/consumer.rb', line 79

def model(value)
  params.model = value
end

#paramsObject



37
38
39
# File 'lib/vx/lib/consumer.rb', line 37

def params
  @params ||= Params.new(self.name)
end

#queue(*args) ⇒ Object



58
59
60
61
# File 'lib/vx/lib/consumer.rb', line 58

def queue(*args)
  params.queue_options = args.last.is_a?(Hash) ? args.pop : nil
  params.queue_name    = args.first
end

#routing_key(name) ⇒ Object



63
64
65
# File 'lib/vx/lib/consumer.rb', line 63

def routing_key(name)
  params.routing_key = name
end

#sessionObject



83
84
85
# File 'lib/vx/lib/consumer.rb', line 83

def session
  Consumer.session
end

#topicObject



50
51
52
# File 'lib/vx/lib/consumer.rb', line 50

def topic
  params.exchange_type = :topic
end

#with_middlewares(name, env, &block) ⇒ Object



95
96
97
# File 'lib/vx/lib/consumer.rb', line 95

def with_middlewares(name, env, &block)
  Consumer.configuration.builders[name].to_app(block).call(env)
end