Class: QueueBus::Rider

Inherits:
Object
  • Object
show all
Defined in:
lib/queue_bus/rider.rb

Overview

queue’d in each

Class Method Summary collapse

Class Method Details

.perform(attributes = {}) ⇒ Object



6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
# File 'lib/queue_bus/rider.rb', line 6

def perform(attributes = {})
  sub_key = attributes["bus_rider_sub_key"]
  app_key = attributes["bus_rider_app_key"]
  raise "No application key passed" if app_key.to_s == ""
  raise "No subcription key passed" if sub_key.to_s == ""
  
  attributes ||= {}
  
  ::QueueBus.log_worker("Rider received: #{app_key} #{sub_key} #{attributes.inspect}")
  
  # attributes that should be available
  # attributes["bus_event_type"]
  # attributes["bus_app_key"]
  # attributes["bus_published_at"]
  # attributes["bus_driven_at"]
  
  # (now running with the real app that subscribed)
  ::QueueBus.dispatcher_execute(app_key, sub_key, attributes.merge("bus_executed_at" => Time.now.to_i))
end