Class: Acta::Reactor
Class Method Summary collapse
-
.queue_as(name) ⇒ Object
Declares the ActiveJob queue name to enqueue this reactor’s job on.
- .queue_name ⇒ Object
- .sync! ⇒ Object
- .sync? ⇒ Boolean
Methods inherited from Handler
Class Method Details
.queue_as(name) ⇒ Object
Declares the ActiveJob queue name to enqueue this reactor’s job on. Read by Acta’s dispatcher when the reactor is async (the default); ignored for ‘sync!` reactors. With no per-class declaration, the global `Acta.reactor_queue` setting applies; if that’s also unset, ActiveJob’s ‘:default` queue is used.
class WelcomeEmailReactor < Acta::Reactor
queue_as :fast
on UserSignedUp do |event|
UserMailer.welcome(event.user_id).deliver_later
end
end
26 27 28 |
# File 'lib/acta/reactor.rb', line 26 def queue_as(name) @queue_name = name end |
.queue_name ⇒ Object
30 31 32 33 34 |
# File 'lib/acta/reactor.rb', line 30 def queue_name return @queue_name if defined?(@queue_name) Acta.reactor_queue end |
.sync! ⇒ Object
6 7 8 |
# File 'lib/acta/reactor.rb', line 6 def sync! @sync = true end |
.sync? ⇒ Boolean
10 11 12 |
# File 'lib/acta/reactor.rb', line 10 def sync? @sync == true end |