Class: Resugan::Worker::ParallelQueueDispatcher

Inherits:
Object
  • Object
show all
Defined in:
lib/resugan/worker/parallel_queue_dispatcher.rb

Instance Method Summary collapse

Instance Method Details

#dispatch(namespace, events) ⇒ Object



12
13
14
15
16
17
18
# File 'lib/resugan/worker/parallel_queue_dispatcher.rb', line 12

def dispatch(namespace, events)
  @queues ||= {}
  @queues[namespace] ||= ParallelQueue.new(redis, 'resugan_queue-' + namespace)
  events.each do |k, v|
    @queues[namespace].enqueue('default', { event: k, args: v }.to_json)
  end
end

#redisObject



4
5
6
# File 'lib/resugan/worker/parallel_queue_dispatcher.rb', line 4

def redis
  @redis ||= Redis.new
end

#redis=(redis) ⇒ Object



8
9
10
# File 'lib/resugan/worker/parallel_queue_dispatcher.rb', line 8

def redis=(redis)
  @redis = redis
end