Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions lib/active_publisher.rb
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,8 @@ def self.configure
# @param [String] payload The message you are sending. Should already be encoded as a string.
# @param [String] exchange The exchange you want to publish to.
# @param [Hash] options hash to set message parameters (e.g. headers)
def self.publish(route, payload, exchange_name, options = {})
with_exchange(exchange_name) do |exchange|
def self.publish(route, payload, exchange_name, options = {}, exchange_options = {})
with_exchange(exchange_name, exchange_options) do |exchange|
exchange.publish(payload, publishing_options(route, options))
end
end
Expand All @@ -49,12 +49,12 @@ def self.publishing_options(route, options = {})
end
end

def self.with_exchange(exchange_name)
def self.with_exchange(exchange_name, exchange_options = {})
connection = ::ActivePublisher::Connection.connection
channel = connection.create_channel
begin
channel.confirm_select if configuration.publisher_confirms
exchange = channel.topic(exchange_name)
exchange = channel.topic(exchange_name, exchange_options)
yield(exchange)
channel.wait_for_confirms if configuration.publisher_confirms
ensure
Expand Down