Sha256: 458397bc55b1a7c565550dcb110b4fc74b6b36fb43d8fd29927765bf6035d163
Contents?: true
Size: 757 Bytes
Versions: 9
Compression:
Stored size: 757 Bytes
Contents
module Ahoy module Stores class KafkaStore < LogStore def log_visit(data) post(visits_topic, data) end def log_event(data) post(events_topic, data) end def client @client ||= begin client = Kafka.new( seed_brokers: ENV["KAFKA_URL"], logger: Rails.logger ) at_exit { client.shutdown } client end end def producer @producer ||= client.async_producer(delivery_interval: 3) end def post(topic, data) producer.produce(data.to_json, topic: topic) end def visits_topic "ahoy_visits" end def events_topic "ahoy_events" end end end end
Version data entries
9 entries across 9 versions & 1 rubygems