Class: Baton::API
- Inherits:
-
Object
- Object
- Baton::API
- Defined in:
- lib/baton/api.rb
Class Method Summary collapse
-
.publish(message, key) ⇒ Object
Public: Method that publishes a message using Bunny to an exchange.
Class Method Details
.publish(message, key) ⇒ Object
Public: Method that publishes a message using Bunny to an exchange.
message - a json object containing the message key - the routing key used to forward the message to the right queue(s)
Examples
publish("{\"message\":\"a message\",\"type\":\"a type\"}", "server.production")
Returns nothing.
18 19 20 21 22 23 24 |
# File 'lib/baton/api.rb', line 18 def self.publish(, key) b = Bunny.new(Baton.configuration.connection_opts) b.start e = b.exchange(Baton.configuration.exchange, :auto_delete => false) e.publish(, :key => key, :mandatory => true) b.stop end |