Class: Announce::Adapters::InlineAdapter::Topic

Inherits:
BaseAdapter::Topic show all
Defined in:
lib/announce/adapters/inline_adapter.rb

Instance Attribute Summary

Attributes inherited from BaseAdapter::Destination

#action, #options, #subject

Instance Method Summary collapse

Methods inherited from BaseAdapter::Destination

app, #create, delimiter, #initialize, #name, name_for, namespace, prefix, #verify

Constructor Details

This class inherits a constructor from Announce::Adapters::BaseAdapter::Destination

Instance Method Details

#publish(message, options = {}) ⇒ Object



24
25
26
27
28
29
30
31
32
33
# File 'lib/announce/adapters/inline_adapter.rb', line 24

def publish(message, options = {})
  queue_name = Queue.name_for(subject, action)
  worker_class = InlineAdapter.subscriptions[queue_name]
  if defined?(::ActiveJob)
    job = worker_class.new(message)
    ::ActiveJob::Base.execute(job.serialize)
  else
    worker_class.new.perform(message)
  end
end