Class: Firehose::Publisher

Inherits:
Object
  • Object
show all
Defined in:
lib/firehose/publisher.rb

Instance Method Summary collapse

Instance Method Details

#publish(path, message) ⇒ Object



3
4
5
6
7
8
9
10
# File 'lib/firehose/publisher.rb', line 3

def publish(path, message)
  channel   = AMQP::Channel.new(Firehose.amqp.connection)
  exchange  = AMQP::Exchange.new(channel, :fanout, path, :auto_delete => true)
  # TODO How do I clean up this exchange at this point? Do I close it somehow or the channel?
  # The exchange just hangs out indefinitely now.
  exchange.publish(message)
  exchange.delete(:if_unused => true)
end