Permalink
Browse files

added MessageMaker class

  • Loading branch information...
1 parent cf077b1 commit 5284f4270ab985f34fd383da7bed81441bd3df8b @evserykh evserykh committed Apr 25, 2012
Showing with 17 additions and 0 deletions.
  1. +17 −0 lib/esp-commons/message_maker.rb
@@ -0,0 +1,17 @@
+require 'bunny'
+
+class MessageMaker
+ def self.make_message(routing_key, message)
+ amqp_client = Bunny.new(Settings['amqp.url'], :logging => false)
+
+ amqp_client.start
+
+ exchange = amqp_client.exchange('esp.exchange', :type => :topic)
+
+ queue = amqp_client.queue('esp.queue', :durable => true)
+
+ exchange.publish(message, :key => routing_key, :persistent => true)
+
+ amqp_client.stop
+ end
+end

0 comments on commit 5284f42

Please sign in to comment.