Use blocking get call w/ timeout to read msg queue

Add parameters to the queue get method in the xapp_frame loop that reads
messages so it waits for a message to arrive and occasionally checks for
the end-loop flag, instead of spinning the CPU at 100% while waiting.

Upgrade all to use the latest RMR, version 4.0.5.

Tweak the example xapps to emit their names in log messages.

Improve documentation especially the package overview shown at PyPI.

Issue-ID: RIC-354
Signed-off-by: Lott, Christopher (cl778h) <cl778h@att.com>
Change-Id: I08692e6ef60d199cb0b92c1c99740ae808b8885c
diff --git a/examples/Dockerfile-Ping b/examples/Dockerfile-Ping
index 66e3f0a..40b19d8 100644
--- a/examples/Dockerfile-Ping
+++ b/examples/Dockerfile-Ping
@@ -17,7 +17,7 @@
 FROM python:3.8-alpine
 
 # copy rmr libraries from builder image in lieu of an Alpine package
-COPY --from=nexus3.o-ran-sc.org:10002/o-ran-sc/bldr-alpine3-rmr:4.0.2 /usr/local/lib64/librmr* /usr/local/lib64/
+COPY --from=nexus3.o-ran-sc.org:10002/o-ran-sc/bldr-alpine3-rmr:4.0.5 /usr/local/lib64/librmr* /usr/local/lib64/
 # RMR setup
 RUN mkdir -p /opt/route/
 COPY test_route.rt /opt/route/test_route.rt
diff --git a/examples/Dockerfile-Pong b/examples/Dockerfile-Pong
index 5d09213..8013e90 100644
--- a/examples/Dockerfile-Pong
+++ b/examples/Dockerfile-Pong
@@ -17,7 +17,7 @@
 FROM python:3.8-alpine
 
 # copy rmr libraries from builder image in lieu of an Alpine package
-COPY --from=nexus3.o-ran-sc.org:10002/o-ran-sc/bldr-alpine3-rmr:4.0.2 /usr/local/lib64/librmr* /usr/local/lib64/
+COPY --from=nexus3.o-ran-sc.org:10002/o-ran-sc/bldr-alpine3-rmr:4.0.5 /usr/local/lib64/librmr* /usr/local/lib64/
 # RMR setup
 RUN mkdir -p /opt/route/
 COPY test_route.rt /opt/route/test_route.rt
diff --git a/examples/ping_xapp.py b/examples/ping_xapp.py
index aafebb8..c247ee3 100644
--- a/examples/ping_xapp.py
+++ b/examples/ping_xapp.py
@@ -29,10 +29,10 @@
     number = 0
     while True:
         # test healthcheck
-        print("Healthy? {}".format(xapp.healthcheck()))
+        print("ping is healthy? {}".format(xapp.healthcheck()))
 
         # rmr send to default handler
-        self.rmr_send(json.dumps({"sup": number}).encode(), 6660666)
+        self.rmr_send(json.dumps({"ping": number}).encode(), 6660666)
 
         # rmr send 60000, should trigger registered callback
         val = json.dumps({"test_send": number}).encode()
@@ -40,18 +40,19 @@
         number += 1
 
         # store it in SDL and read it back; delete and read
-        self.sdl_set(my_ns, "numba", number)
-        self.logger.info(self.sdl_get(my_ns, "numba"))
-        self.logger.info(self.sdl_find_and_get(my_ns, "num"))
-        self.sdl_delete(my_ns, "numba")
-        self.logger.info(self.sdl_get(my_ns, "numba"))
+        self.sdl_set(my_ns, "ping", number)
+        self.logger.info(self.sdl_get(my_ns, "ping"))
+        self.logger.info(self.sdl_find_and_get(my_ns, "pin"))
+        self.sdl_delete(my_ns, "ping")
+        self.logger.info(self.sdl_get(my_ns, "ping"))
 
         # rmr receive
         for (summary, sbuf) in self.rmr_get_messages():
-            # summary is a dict that contains bytes so we can't use json.dumps on it so we have no good way to turn this into a string to use the logger unfortunately
+            # summary is a dict that contains bytes so we can't use json.dumps on it
+            # so we have no good way to turn this into a string to use the logger unfortunately
             # print is more "verbose" than the ric logger
             # if you try to log this you will get: TypeError: Object of type bytes is not JSON serializable
-            print(summary)
+            print("ping: {0}".format(summary))
             self.rmr_free(sbuf)
 
         time.sleep(2)
diff --git a/examples/pong_xapp.py b/examples/pong_xapp.py
index 863f635..23db376 100644
--- a/examples/pong_xapp.py
+++ b/examples/pong_xapp.py
@@ -28,9 +28,9 @@
 
 def sixtyh(self, summary, sbuf):
     """callback for 60000"""
-    self.logger.info("registered 60000 handler called!")
+    self.logger.info("pong registered 60000 handler called!")
     # see comment in ping about this; bytes does not work with the ric mdc logger currently
-    print(summary)
+    print("pong 60000 handler received: {0}".format(summary))
     jpay = json.loads(summary[rmr.RMR_MS_MSG_PAYLOAD])
     self.rmr_rts(sbuf, new_payload=json.dumps({"ACK": jpay["test_send"]}).encode(), new_mtype=60001, retries=100)
     self.rmr_free(sbuf)
@@ -38,8 +38,8 @@
 
 def defh(self, summary, sbuf):
     """default callback"""
-    self.logger.info("default handler called!")
-    print(summary)
+    self.logger.info("pong default handler called!")
+    print("pong default handler received: {0}".format(summary))
     self.rmr_free(sbuf)