def record_messages(connection, topic, output):
 def process_event(body):
  print ('%s: %s' % (body.get('timestamp'), body.get('event_type', 'unknown event')))
  pickle.dump(body, output)
 connection.declare_topic_consumer(topic, process_event)
 try:
  connection.consume()
 except KeyboardInterrupt:
  pass

def record_messages ( connection , topic , output ) : def process_event ( body ) : print ( '%s: %s' % ( body . get ( 'timestamp' ) , body . get ( 'event_type' , 'unknown event' ) ) ) pickle . dump ( body , output ) connection . declare_topic_consumer ( topic , process_event ) try : connection . consume ( ) except KeyboardInterrupt : pass
listen to notification .