lib/barbeque_client/client.rb in barbeque_client-0.10.0 vs lib/barbeque_client/client.rb in barbeque_client-0.10.1
- old
+ new
@@ -1,15 +1,16 @@
require 'garage_client'
require 'json'
module BarbequeClient
class Client
- def initialize(application:, default_queue:, endpoint:, tracing: {})
+ def initialize(application:, default_queue:, endpoint:, tracing: {}, headers: nil)
@application = application
@default_queue = default_queue
@endpoint = endpoint
@tracing = tracing || {}
+ @headers = headers
end
# @param [String] job - Job name to enqueue.
# @param [Object] message - An object which is serializable as JSON.
# @param optional [String] queue - A queue name to enqueue a job.
@@ -57,9 +58,12 @@
end
def garage_client_option
option = { endpoint: @endpoint, path_prefix: '/' }
option[:tracing] = @tracing if @tracing[:tracer]
+ if @headers
+ option[:headers] = @headers
+ end
option
end
end
end