Sha256: 6b01c368940a9cd6a44736c3cf6c13a6601b2d091341ca02c0ffededb6303e93

Contents?: true

Size: 586 Bytes

Versions: 14

Compression:

Stored size: 586 Bytes

Contents

module Ahoy
  module Stores
    class BunnyStore < LogStore
      def log_visit(data)
        post(visits_queue, data)
      end

      def log_event(data)
        post(events_queue, data)
      end

      def channel
        @channel ||= begin
          conn = Bunny.new
          conn.start
          conn.create_channel
        end
      end

      def post(queue, message)
        channel.queue(queue, durable: true).publish(message.to_json)
      end

      def visits_queue
        "ahoy_visits"
      end

      def events_queue
        "ahoy_events"
      end
    end
  end
end

Version data entries

14 entries across 14 versions & 1 rubygems

Version Path
ahoy_matey-1.6.1 lib/ahoy/stores/bunny_store.rb
ahoy_matey-1.6.0 lib/ahoy/stores/bunny_store.rb
ahoy_matey-1.5.5 lib/ahoy/stores/bunny_store.rb
ahoy_matey-1.5.4 lib/ahoy/stores/bunny_store.rb
ahoy_matey-1.5.3 lib/ahoy/stores/bunny_store.rb
ahoy_matey-1.5.2 lib/ahoy/stores/bunny_store.rb
ahoy_matey-1.5.1 lib/ahoy/stores/bunny_store.rb
ahoy_matey-1.5.0 lib/ahoy/stores/bunny_store.rb
ahoy_matey-1.4.2 lib/ahoy/stores/bunny_store.rb
ahoy_matey-1.4.1 lib/ahoy/stores/bunny_store.rb
ahoy_matey-1.4.0 lib/ahoy/stores/bunny_store.rb
ahoy_matey-1.3.1 lib/ahoy/stores/bunny_store.rb
ahoy_matey-1.3.0 lib/ahoy/stores/bunny_store.rb
ahoy_matey-1.2.2 lib/ahoy/stores/bunny_store.rb