Module: Tackle

Defined in:
lib/tackle.rb,
lib/tackle/version.rb,
lib/tackle/consumer.rb,
lib/tackle/publisher.rb,
lib/tackle/connection.rb,
lib/tackle/consumer/queue.rb,
lib/tackle/consumer/params.rb,
lib/tackle/consumer/message.rb,
lib/tackle/consumer/exchange.rb,
lib/tackle/consumer/dead_queue.rb,
lib/tackle/consumer/main_queue.rb,
lib/tackle/consumer/delay_queue.rb,
lib/tackle/consumer/active_record_connection_reaper.rb

Defined Under Namespace

Classes: Connection, Consumer, Publisher

Constant Summary collapse

ACK =
:ack
NACK =
:nack
VERSION =
"1.2.0".freeze

Class Method Summary collapse

Class Method Details

.consume(params = {}, &block) ⇒ Object



15
16
17
18
19
20
# File 'lib/tackle.rb', line 15

def consume(params = {}, &block)
  params   = Tackle::Consumer::Params.new(params)
  consumer = Tackle::Consumer.new(params)

  consumer.subscribe(&block)
end

.publish(message, options = {}) ⇒ Object



22
23
24
25
26
27
28
29
30
# File 'lib/tackle.rb', line 22

def publish(message, options = {})
  url         = options.fetch(:url)
  exchange    = options.fetch(:exchange)
  routing_key = options.fetch(:routing_key)
  logger      = options.fetch(:logger, Logger.new(STDOUT))
  connection  = options.fetch(:connection, nil)

  Tackle::Publisher.new(url, exchange, routing_key, logger, connection).publish(message)
end