#NEWLINE# def on_message( channel , method_frame , header_frame , body ) : #NEWLINE# #INDENT# channel . queue_declare ( queue = body , auto_delete = True ) #NEWLINE# if body . startswith ( 'queue:' ) : #NEWLINE# #INDENT# queue = body . replace ( 'queue:' , '' ) #NEWLINE# key = ( body + '_key' ) #NEWLINE# print ( ( 'Declaring queue %s bound with key %s' % ( queue , key ) ) ) #NEWLINE# channel . queue_declare ( queue = queue , auto_delete = True ) #NEWLINE# channel . queue_bind ( queue = queue , exchange = 'test_exchange' , routing_key = key ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# print ( 'Message body' , key ) #NEWLINE# #UNINDENT# channel . basic_ack ( delivery_tag = method_frame . delivery_tag )