Class: Nezu::Runtime::Producer

Inherits:
Object
  • Object
show all
Extended by:
Common
Defined in:
lib/nezu/runtime/producer.rb

Class Method Summary collapse

Methods included from Common

descendants, inherited

Class Method Details

.push!(params = {}) ⇒ Object



6
7
8
9
10
11
12
13
# File 'lib/nezu/runtime/producer.rb', line 6

def self.push!(params = {})
  connection = Bunny.new(Nezu::Config.amqp[Nezu.env.to_sym].url, :threaded => false)
  connection.start
  channel = connection.create_channel
  queue ||= channel.queue(queue_name)
  queue.publish(params.to_json, :content_type => 'application/json')
  connection.close
end