6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
|
# File 'lib/vx/common/amqp/consumer/publish.rb', line 6
def publish(message, options = nil)
session.open
options ||= {}
options[:routing_key] = routing_key if routing_key && !options.key?(:routing_key)
options[:headers] = if && !options.key?(:headers)
options[:content_type] ||= content_type || config.content_type
x = declare_exchange
instrumentation = {
message: message.inspect,
exchange: x.name,
consumer: consumer_id
}
instrument("start_publishing.consumer.amqp", instrumentation)
instrument("process_publishing.consumer.amqp", instrumentation) do
m = serialize_message message, options[:content_type]
x.publish m, options
end
self
end
|