<s> import pika <EOL> USE_EXCHANGE = True <EOL> QUEUE_NAME = '<STR_LIT>' <EOL> EXCHANGE_NAME = '<STR_LIT>' <EOL> EXCHANGE_TYPE = '<STR_LIT>' <EOL> SEVERITIES = [ '<STR_LIT:error>' , '<STR_LIT>' , '<STR_LIT:info>' , '<STR_LIT:success>' , ] <EOL> DEFAULT_SEVERITY = '<STR_LIT:info>' <EOL> tier = '<STR_LIT>' <EOL> host = '<STR_LIT:localhost>' if tier == '<STR_LIT>' else '<STR_LIT>' <EOL> connection = pika . BlockingConnection ( pika . ConnectionParameters ( host ) ) <EOL> channel = connection . channel ( ) <EOL> channel . exchange_declare ( exchange = EXCHANGE_NAME , type = EXCHANGE_TYPE ) <EOL> if USE_EXCHANGE : <EOL> result = channel . queue_declare ( queue = QUEUE_NAME , durable = True ) <EOL> else : <EOL> result = channel . queue_declare ( exclusive = True ) <EOL> def get_routing_key ( args ) : <EOL> return args if len ( args ) > <NUM_LIT:1> else DEFAULT_SEVERITY </s>
