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

Defined Under Namespace

Classes: Connection, Consumer, Publisher

Constant Summary collapse

VERSION =
"1.0"

Class Method Summary collapse

Class Method Details

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



12
13
14
15
16
17
# File 'lib/tackle.rb', line 12

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

  consumer.subscribe(&block)
end

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



19
20
21
22
23
24
25
26
# File 'lib/tackle.rb', line 19

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))

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