Skip to content

Commit

Permalink
DSL
Browse files Browse the repository at this point in the history
  • Loading branch information
0exp committed Oct 11, 2024
1 parent 0f600a0 commit 6de4277
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
10 changes: 9 additions & 1 deletion lib/rabbit/event_handler.rb
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,22 @@ class Rabbit::EventHandler

class_attribute :queue
class_attribute :ignore_queue_conversion, default: false
class_attribute :job_configs, default: {}
class_attribute :additional_job_configs, default: {}

class << self
private

def queue_as(queue = nil, &block)
self.queue = queue || block
end

def job_config(**config_opts)
self.additional_job_configs.merge!(config_opts)
end

def job_configs(**config_opts)
self.additional_job_configs = config_opts
end
end

def initialize(message)
Expand Down
2 changes: 1 addition & 1 deletion lib/rabbit/receiving/receive.rb
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ def queue
end

def job_configs
queue.handler.job_configs
queue.handler.additional_job_configs
end

def queue_name
Expand Down

0 comments on commit 6de4277

Please sign in to comment.