Class: Ribbon::EventBus::Publishers::RemoteResquePublisher

Inherits:
Publisher
  • Object
show all
Defined in:
lib/ribbon/event_bus/publishers/remote_resque_publisher.rb

Instance Method Summary collapse

Methods inherited from Publisher

#config, #initialize

Methods included from Mixins::HasConfig

#_has_config_config, #_has_config_load_config, #config, included

Methods included from Mixins::HasInstance

#instance

Constructor Details

This class inherits a constructor from Ribbon::EventBus::Publishers::Publisher

Instance Method Details

#publish(event) ⇒ Object



10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
# File 'lib/ribbon/event_bus/publishers/remote_resque_publisher.rb', line 10

def publish(event)
  super

  # Based on Resque 1.25.2

  # Resque call stack:
  # -> Resque.enqueue(klass, *args)
  # -> Resque.enqueue_to(queue, klass, *args)
  # -> Job.create(queue, klass, *args)
  # -> Resque.push(queue, class: klass.to_s, args: args)

  # These should be the same as the args passed to Resque.enqueue in
  # ResquePublisher#publish(event).
  args = [
    config.subscription_queue_format.to_s,
    event.serialize
  ]

  enqueue_to(config.queue.to_s, Publishers::ResquePublisher::PublisherJob, *args)
end

#redisObject



31
32
33
# File 'lib/ribbon/event_bus/publishers/remote_resque_publisher.rb', line 31

def redis
  @redis ||= _redis
end