print("not yet ready")
print("listening ON {}".format(PORT))
-sbuf = None
while True:
+ sbuf = rmr.rmr_alloc_msg(mrc, 4096)
sbuf = rmr.rmr_torcv_msg(mrc, sbuf, 1000)
summary = rmr.message_summary(sbuf)
if summary["message state"] == 12 and summary["message status"] == "RMR_ERR_TIMEOUT":
sbuf.contents.mtype = 21024
print("Pre reply summary: {}".format(rmr.message_summary(sbuf)))
time.sleep(DELAY)
- sbuf = rmr.rmr_rts_msg(mrc, sbuf)
- print("Post reply summary: {}".format(rmr.message_summary(sbuf)))
+
+ # try up to 5 times to send back the ack
+ for _ in range(5):
+ sbuf = rmr.rmr_rts_msg(mrc, sbuf)
+ post_reply_summary = rmr.message_summary(sbuf)
+ print("Post reply summary: {}".format(post_reply_summary))
+ if post_reply_summary["message state"] == 10 and post_reply_summary["message status"] == "RMR_ERR_RETRY":
+ time.sleep(1)
+ else:
+ break