+# Fetch all callback message for an id in an array
+# URI and parameter, (GET): /get-all-events/<id>
+# response: message + 200 or just 500(error)
+@app.route(APP_READ_ALL_URL,
+ methods=['GET'])
+def receiveresponse_all(id):
+ global msg_callbacks
+ global cntr_msg_fetched
+
+ try:
+ if ((id in msg_callbacks.keys()) and (len(msg_callbacks[id]) > 0)):
+ cntr_msg_fetched+=len(msg_callbacks[id])
+ cntr_callbacks[id][1]+=len(msg_callbacks[id])
+ msg=msg_callbacks[id]
+ print("Fetching all msgs for id: "+id+", msg="+str(msg))
+ for sub_msg in msg:
+ del sub_msg[TIME_STAMP]
+ del msg_callbacks[id]
+ return json.dumps(msg),200
+ print("No messages for id: "+id)
+ except Exception as e:
+ print(CAUGHT_EXCEPTION+str(e))
+ traceback.print_exc()
+ return "",500
+
+ msg=[]
+ return json.dumps(msg),200