Class: Totoro::BaseQueue

Inherits:
Object
  • Object
show all
Defined in:
lib/totoro/base_queue.rb

Class Method Summary collapse

Class Method Details

.broadcast(id, payload, attrs = {}) ⇒ Object



16
17
18
19
20
# File 'lib/totoro/base_queue.rb', line 16

def broadcast(id, payload, attrs = {})
  Totoro::BroadcastService.new(connection, config).broadcast(id, payload, attrs)
rescue Totoro::ConnectionBreakError => error
  handle_failed_msg(id, payload, error, :broadcast)
end

.configObject



8
9
10
# File 'lib/totoro/base_queue.rb', line 8

def config
  @config ||= Totoro::Config.new
end

.connectionObject



12
13
14
# File 'lib/totoro/base_queue.rb', line 12

def connection
  @connection ||= Bunny.new(config.connect.merge(threaded: false))
end

.enqueue(id, payload, attrs = {}) ⇒ Object



22
23
24
25
26
# File 'lib/totoro/base_queue.rb', line 22

def enqueue(id, payload, attrs = {})
  Totoro::EnqueueService.new(connection, config).enqueue(id, payload, attrs)
rescue Totoro::ConnectionBreakError => error
  handle_failed_msg(id, payload, error, :enqueue)
end