<s> import sys , json , pika , time , traceback <EOL> def msg_rcvd ( channel , method , header , body ) : <EOL> message = json . loads ( body ) <EOL> print "<STR_LIT>" % message <EOL> channel . basic_ack ( delivery_tag = method . delivery_tag ) <EOL> if __name__ == "<STR_LIT:__main__>" : <EOL> AMQP_SERVER = sys . argv [ <NUM_LIT:1> ] <EOL> AMQP_PORT = int ( sys . argv [ <NUM_LIT:2> ] ) <EOL> creds_broker = pika . PlainCredentials ( "<STR_LIT>" , "<STR_LIT>" ) <EOL> conn_params = pika . ConnectionParameters ( AMQP_SERVER , <EOL> port = AMQP_PORT , <EOL> virtual_host = "<STR_LIT:/>" , <EOL> credentials = creds_broker ) <EOL> conn_broker = pika . BlockingConnection ( conn_params ) <EOL> channel = conn_broker . channel ( ) <EOL> print "<STR_LIT>" <EOL> channel . basic_consume ( msg_rcvd , <EOL> queue = "<STR_LIT>" , <EOL> no_ack = False , <EOL> consumer_tag = "<STR_LIT>" ) <EOL> channel . start_consuming ( ) </s>
