Sha256: 68880022a41891ad92ad6d916268801c0a7d5fd1ccb5d35cc7b9ce15a594cec6

Contents?: true

Size: 974 Bytes

Versions: 1

Compression:

Stored size: 974 Bytes

Contents

require 'json'
require 'bunny'

require 'songkick_queue/version'
require 'songkick_queue/client'
require 'songkick_queue/consumer'
require 'songkick_queue/producer'
require 'songkick_queue/worker'
require 'songkick_queue/cli'

module SongkickQueue
  Configuration = Struct.new(:amqp, :logger, :queue_namespace)
  ConfigurationError = Class.new(StandardError)

  # Retrieve configuration for SongkickQueue
  #
  # @return [Configuration]
  def self.configuration
    @configuration ||= Configuration.new
  end

  # Yields a block, passing the memoized configuration instance
  #
  # @yield [Configuration]
  def self.configure
    yield(configuration)
  end

  # Publishes the given message to the given queue
  #
  # @param queue_name [String] to publish to
  # @param message [#to_json] to serialize and enqueue
  def self.publish(queue_name, message)
    producer.publish(queue_name, message)
  end

  private

  def self.producer
    @producer ||= Producer.new
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
songkick_queue-0.2.0 lib/songkick_queue.rb