Commit 88a79f4d authored by Jonathan Schaeffer's avatar Jonathan Schaeffer
Browse files

Loop mode

parent b493b68e
......@@ -12,8 +12,7 @@ import traceback
from proton.utils import BlockingConnection
from proton import Message
from .resif_pyinventory import resif_pyinventory
from resif_pyinventory import resif_pyinventory
SCRIPT_VERSION = 2021.190
......@@ -201,33 +200,33 @@ if __name__ == "__main__":
logger.info("Connected to %s : %s", AMQP_SERVER, connection)
try:
# wait for message on queue
logger.info(
"waiting for incoming message on queue %s ~~~~~~~~~~~~ ", queue
)
message = receiver.receive(timeout=None)
logger.info("message received : %s", message)
# launch subsequent action
if isinstance(message.body, bytes):
m = message.body.decode('utf-8')
else:
m = message.body
if args.validated_data_integrated_files:
validated_data_integrated_files(m)
if args.seedtree:
seedtree(m)
if args.wfcatalog:
wfcatalog(m)
receiver.accept()
logger.info("message acknowledged")
while True:
# wait for message on queue
logger.info(
"waiting for incoming message on queue %s ~~~~~~~~~~~~ ", queue
)
message = receiver.receive(timeout=None)
logger.info("message received : %s", message)
# launch subsequent action
if isinstance(message.body, bytes):
m = message.body.decode('utf-8')
else:
m = message.body
if args.validated_data_integrated_files:
validated_data_integrated_files(m)
if args.seedtree:
seedtree(m)
if args.wfcatalog:
wfcatalog(m)
receiver.accept()
logger.info("message acknowledged")
except Exception as err:
logger.critical(traceback.format_exc())
logger.critical(str(err))
raise
connection.close()
logger.critical("amqp worker quitting")
sys.exit(1)
finally:
connection.close()
logger.info("amqp worker quitting")
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment