Class: NtiEventBus::HandleEventJob

Inherits:
ActiveJob::Base
  • Object
show all
Defined in:
lib/nti_event_bus/handle_event_job.rb

Overview

ActiveJob that runs a single handler for a published event.

The handler is passed by name (a String) rather than as a class so the argument serializes cleanly and is re-resolved to the current class version at run time (reload-safe). The queue is read from configuration at enqueue time so hosts can route event work to a dedicated queue.

Instance Method Summary collapse

Instance Method Details

#perform(handler_name, payload) ⇒ Object



15
16
17
18
19
# File 'lib/nti_event_bus/handle_event_job.rb', line 15

def perform(handler_name, payload)
  handler = handler_name.constantize

  handler.new(payload).call
end