Skip to content

Commit fa0fd04

Browse files
author
Siarhei Kavaliou
committed
Make possibility to specify configurations for senders
- Delayed Job: specified default queue - Delayed Job: ability to configure queue name
1 parent 5a7bac9 commit fa0fd04

3 files changed

Lines changed: 8 additions & 3 deletions

File tree

lib/vero/config.rb

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
module Vero
44
class Config
55
attr_writer :domain
6-
attr_accessor :api_key, :secret, :development_mode, :async, :disabled, :logging
6+
attr_accessor :api_key, :secret, :development_mode, :async, :disabled, :logging, :senders_config
77

88
def self.available_attributes
99
[:api_key, :secret, :development_mode, :async, :disabled, :logging, :domain]
@@ -56,6 +56,10 @@ def reset!
5656
self.logging = false
5757
self.api_key = nil
5858
self.secret = nil
59+
self.senders_config = [:delayed_job, :resque, :sidekiq, :sucker_punch].inject({}) do |hash,e|
60+
hash[e] = {}
61+
hash
62+
end
5963
end
6064

6165
def update_attributes(attributes = {})

lib/vero/senders/delayed_job.rb

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,8 @@ module Vero
55
module Senders
66
class DelayedJob
77
def call(api_class, domain, options)
8-
response = ::Delayed::Job.enqueue api_class.new(domain, options)
8+
queue = Vero::Config.senders_config.fetch(:delayed_job, {}).fetch(:queue, :default)
9+
response = ::Delayed::Job.enqueue(api_class.new(domain, options), queue: queue)
910
options_s = JSON.dump(options)
1011
Vero::App.log(self, "method: #{api_class.name}, options: #{options_s}, response: delayed job queued")
1112
response

lib/vero/version.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
module Vero
2-
VERSION = '0.9.1'
2+
VERSION = '0.9.2'
33
end

0 commit comments

Comments
 (0)