Sha256: bd854b054731bec0062cfa562e2e5b95992bc0c83706831daecf938c87a226c4
Contents?: true
Size: 1.17 KB
Versions: 1
Compression:
Stored size: 1.17 KB
Contents
# frozen_string_literal: true require 'emittance/resque/process_event_job' module Emittance module Resque ## # A job that fans out events to their proper listeners. # class EventFanoutJob PROCESS_EVENT_JOB = Emittance::Resque::ProcessEventJob @queue = :default class << self def perform(event) new(event).perform end end def initialize(event) @event = event end def perform registrations.each { |registration| enqueue_job registration, event } end private attr_reader :event def registrations identifier = event['identifier'] Emittance::Resque::Dispatcher.registrations_for(identifier) end def enqueue_job(registration, event) queue = queue_from_registration(registration) ::Resque.enqueue_to( queue, PROCESS_EVENT_JOB, registration.klass_name, registration.method_name, event ) end def queue_from_registration(registration) registration.queue || default_queue end def default_queue Emittance::Resque::Dispatcher.default_queue end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
emittance-resque-1.1.0 | lib/emittance/resque/event_fanout_job.rb |