Skip to content

Instantly share code, notes, and snippets.

@DylanLacey
Created August 31, 2011 03:23
Show Gist options
  • Save DylanLacey/1182745 to your computer and use it in GitHub Desktop.
Save DylanLacey/1182745 to your computer and use it in GitHub Desktop.
EM & AMQP
class Main
t = Thread.new do
EventMachine.run
end
sleep(5)
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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment