Skip to content

Instantly share code, notes, and snippets.

@iamnader
Created July 13, 2012 18:09
Show Gist options
  • Save iamnader/3106391 to your computer and use it in GitHub Desktop.
Save iamnader/3106391 to your computer and use it in GitHub Desktop.
MyMq
class MyMq
def self.client
unless @client
c = Bunny.new(APP_CONFIG["cloudamqp_url"], :logging => true)
c.start
@client = c
end
@client
end
def self.stop
@client.stop if @client
end
def self.purge
messages_queue.purge
end
def self.nameless_exchange
@nameless_exchange ||= client.exchange('')
end
def self.messages_queue
@messages_queue ||= client.queue("#{Rails.env}:messages")
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment