Class: Ahoy::Stores::BunnyStore
Instance Method Summary
collapse
Methods inherited from LogStore
#track_event, #track_visit
Methods inherited from BaseStore
#authenticate, #exclude?, #generate_id, #initialize, #report_exception, #track_event, #track_visit, #user, #visit
Instance Method Details
#channel ⇒ Object
12
13
14
15
16
17
18
|
# File 'lib/ahoy/stores/bunny_store.rb', line 12
def channel
@channel ||= begin
conn = Bunny.new
conn.start
conn.create_channel
end
end
|
#events_queue ⇒ Object
28
29
30
|
# File 'lib/ahoy/stores/bunny_store.rb', line 28
def events_queue
"ahoy_events"
end
|
#log_event(data) ⇒ Object
8
9
10
|
# File 'lib/ahoy/stores/bunny_store.rb', line 8
def log_event(data)
post(events_queue, data)
end
|
#log_visit(data) ⇒ Object
4
5
6
|
# File 'lib/ahoy/stores/bunny_store.rb', line 4
def log_visit(data)
post(visits_queue, data)
end
|
#post(queue, message) ⇒ Object
20
21
22
|
# File 'lib/ahoy/stores/bunny_store.rb', line 20
def post(queue, message)
channel.queue(queue, durable: true).publish(message.to_json)
end
|
#visits_queue ⇒ Object
24
25
26
|
# File 'lib/ahoy/stores/bunny_store.rb', line 24
def visits_queue
"ahoy_visits"
end
|