Sha256: 2bc504bfc2015861c6ef7495b32e94d427fe775e3605bfcc923089ae1f4b52d4
Contents?: true
Size: 699 Bytes
Versions: 16
Compression:
Stored size: 699 Bytes
Contents
require "baton" require "bunny" require "json" module Baton class API # 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. def self.publish(message, key) b = Bunny.new(Baton.configuration.connection_opts) b.start e = b.exchange(Baton.configuration.exchange, :auto_delete => false) e.publish(message, :key => key, :mandatory => true) b.stop end end end
Version data entries
16 entries across 16 versions & 1 rubygems