#NEWLINE# def publish_event( queue , routing_key , event , exchange_name = 'cloudify-monitoring' , exchange_type = 'topic' ) : #NEWLINE# #INDENT# connection = pika . BlockingConnection ( pika . ConnectionParameters ( host = 'localhost' ) ) #NEWLINE# channel = connection . channel ( ) #NEWLINE# channel . exchange_declare ( exchange = exchange_name , type = exchange_type , durable = False , auto_delete = True , internal = False ) #NEWLINE# channel . queue_declare ( queue = queue , auto_delete = True , durable = False , exclusive = False ) #NEWLINE# channel . queue_bind ( exchange = exchange_name , queue = channel , routing_key = routing_key ) #NEWLINE# channel . basic_publish ( exchange = exchange_name , routing_key = routing_key , body = json . dumps ( event ) ) #NEWLINE# channel . close ( ) #NEWLINE# connection . close ( )