Skip to content

Instantly share code, notes, and snippets.

@waynerobinson
Created August 31, 2011 03:33
Show Gist options
  • Save waynerobinson/1182760 to your computer and use it in GitHub Desktop.
Save waynerobinson/1182760 to your computer and use it in GitHub Desktop.
Standalone daemon
class QueueDaemon
class << self
def start!
Thread.new do
EventMachine.run do
puts "Asimov: Attempting Connection"
AMQP.connect(
:on_possible_authentication_failure => Proc.new {puts("Asimov: Possible Authentication Failure")},
:on_tcp_connection_failure => Proc.new {puts("Asimov: TCP failure")},
:on_error => Proc.new {puts("Fucked")},
:on_tcp_loss => Proc.new {puts("Still Fucked")},
:on_connection_interrruption => Proc.new {puts("DODGY")}
) do |connection|
puts "Asimov: Connected to host"
end
puts "Blocked like a boss"
end
end
end
end
end
daemon_thread = QueueDaemon.start!
daemon_thread.join
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment