Class: Alondra::MessageQueueClient

Inherits:
Object
  • Object
show all
Defined in:
lib/alondra/message_queue_client.rb

Class Method Summary collapse

Class Method Details

.async_instanceObject



20
21
22
# File 'lib/alondra/message_queue_client.rb', line 20

def self.async_instance
  @async_instance ||= AsyncMessageQueueClient.new
end

.instanceObject



12
13
14
15
16
17
18
# File 'lib/alondra/message_queue_client.rb', line 12

def self.instance
  if EM.reactor_running?
    async_instance
  else
    sync_instance
  end
end

.push(message) ⇒ Object



8
9
10
# File 'lib/alondra/message_queue_client.rb', line 8

def self.push(message)
  instance.send_message(message)
end

.sync_instanceObject



24
25
26
# File 'lib/alondra/message_queue_client.rb', line 24

def self.sync_instance
  @sync_instance ||= SyncMessageQueueClient.new
end