<s> import logging <EOL> from tornado . ioloop import IOLoop <EOL> from stormed import Connection <EOL> def on_connect ( ) : <EOL> ch = conn . channel ( ) <EOL> ch . queue_declare ( queue = '<STR_LIT:hello>' ) <EOL> ch . consume ( '<STR_LIT:hello>' , callback , no_ack = True ) <EOL> def callback ( msg ) : <EOL> print "<STR_LIT>" % msg . body <EOL> def on_close ( ) : <EOL> print "<STR_LIT>" <EOL> conn . connect ( on_connect , on_close ) <EOL> logging . basicConfig ( ) <EOL> conn = Connection ( host = '<STR_LIT:localhost>' ) <EOL> conn . connect ( on_connect , on_close ) <EOL> io_loop = IOLoop . instance ( ) <EOL> print '<STR_LIT>' <EOL> try : <EOL> io_loop . start ( ) <EOL> except KeyboardInterrupt : <EOL> conn . close ( io_loop . stop ) </s>
