6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
|
# File 'lib/evrone/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
run_callbacks(:publish, message: message, exchange: x, name: consumer_name) do
m = serialize_message message, options[:content_type]
x.publish m, options
end
debug "published #{message.inspect} to #{x.name}"
self
end
|