<s> import pika <EOL> credentials = pika . PlainCredentials ( "<STR_LIT>" , "<STR_LIT>" ) <EOL> conn_params = pika . ConnectionParameters ( "<STR_LIT:localhost>" , <EOL> credentials = credentials ) <EOL> conn_broker = pika . BlockingConnection ( conn_params ) <EOL> channel = conn_broker . channel ( ) <EOL> channel . exchange_declare ( exchange = "<STR_LIT>" , <EOL> type = "<STR_LIT>" , <EOL> passive = False , <EOL> durable = True , <EOL> auto_delete = False ) <EOL> queue_args = { "<STR_LIT>" : "<STR_LIT>" , <EOL> "<STR_LIT>" : [ "<STR_LIT>" , <EOL> "<STR_LIT>" ] } <EOL> channel . queue_declare ( queue = "<STR_LIT>" , arguments = queue_args ) <EOL> channel . queue_bind ( queue = "<STR_LIT>" , <EOL> exchange = "<STR_LIT>" , <EOL> routing_key = "<STR_LIT>" ) <EOL> def msg_consumer ( channel , method , header , body ) : <EOL> channel . basic_ack ( delivery_tag = method . delivery_tag ) <EOL> if body == "<STR_LIT>" : <EOL> channel . basic_cancel ( consumer_tag = "<STR_LIT>" ) <EOL> channel . stop_consuming ( ) <EOL> else : <EOL> print body <EOL> return <EOL> channel . basic_consume ( msg_consumer , <EOL> queue = "<STR_LIT>" , <EOL> consumer_tag = "<STR_LIT>" ) <EOL> channel . start_consuming ( ) </s>
