Class: Rabbit::Receiving::Receive
- Inherits:
-
Object
- Object
- Rabbit::Receiving::Receive
- Includes:
- Tainbox
- Defined in:
- lib/rabbit/receiving/receive.rb
Instance Method Summary collapse
- #after_hooks ⇒ Object
- #before_hooks ⇒ Object
- #call ⇒ Object
- #call_hooks(hooks) ⇒ Object
- #job_class ⇒ Object
- #log! ⇒ Object
- #message_info ⇒ Object
- #process_message ⇒ Object
- #queue ⇒ Object
Instance Method Details
#after_hooks ⇒ Object
45 46 47 |
# File 'lib/rabbit/receiving/receive.rb', line 45 def after_hooks Rabbit.config.after_receiving_hooks || [] end |
#before_hooks ⇒ Object
41 42 43 |
# File 'lib/rabbit/receiving/receive.rb', line 41 def before_hooks Rabbit.config.before_receiving_hooks || [] end |
#call ⇒ Object
16 17 18 19 20 21 |
# File 'lib/rabbit/receiving/receive.rb', line 16 def call log! call_hooks(before_hooks) call_hooks(after_hooks) end |
#call_hooks(hooks) ⇒ Object
35 36 37 38 39 |
# File 'lib/rabbit/receiving/receive.rb', line 35 def call_hooks(hooks) hooks.each do |hook_proc| hook_proc.call(, ) end end |
#job_class ⇒ Object
59 60 61 |
# File 'lib/rabbit/receiving/receive.rb', line 59 def job_class Rabbit.config.receiving_job_class_callable&.call || Rabbit::Receiving::Job end |
#log! ⇒ Object
23 24 25 26 27 |
# File 'lib/rabbit/receiving/receive.rb', line 23 def log! Rabbit.config.receive_logger.debug( [, delivery_info, arguments].join(" / "), ) end |
#message_info ⇒ Object
49 50 51 52 53 |
# File 'lib/rabbit/receiving/receive.rb', line 49 def arguments.merge( delivery_info.slice(:exchange, :routing_key), ) end |
#process_message ⇒ Object
29 30 31 32 33 |
# File 'lib/rabbit/receiving/receive.rb', line 29 def job_class .set(queue: queue) .perform_later(, ) end |