diff --git a/.env.example b/.env.example new file mode 100644 index 0000000..7712f8d --- /dev/null +++ b/.env.example @@ -0,0 +1,3 @@ +export TILED_INGEST_TILED_CONFIG_PATH=/dls/tmp/mlex/mlex_tomo_framework/tiled_conda/deploy/config +export STOMP_SERVER=k11-control +export STOMP_TOPIC_NAME=/topic/org.dawnsci.file.topic \ No newline at end of file diff --git a/src/tiled_ingestor/activemq/consumer.py b/src/tiled_ingestor/activemq/consumer.py index 4895b87..d714578 100644 --- a/src/tiled_ingestor/activemq/consumer.py +++ b/src/tiled_ingestor/activemq/consumer.py @@ -7,13 +7,14 @@ import stomp -from .schemas import DIAMOND_FILEPATH_KEY, DIAMOND_STATUS_KEY, STOMP_TOPIC_NAME +from .schemas import DIAMOND_FILEPATH_KEY, DIAMOND_STATUS_KEY from ..ingest import get_tiled_config, process_file import logging TILED_INGEST_TILED_CONFIG_PATH = os.getenv("TILED_INGEST_TILED_CONFIG_PATH") STOMP_SERVER = os.getenv("STOMP_SERVER") STOMP_LOG_LEVEL = os.getenv("STOMP_LOG_LEVEL", "INFO") +STOMP_TOPIC_NAME = os.getenv("STOMP_TOPIC_NAME", "INFO") logging.getLogger("stomp").setLevel(logging.getLevelName(STOMP_LOG_LEVEL)) logging.getLogger("asyncio").setLevel(logging.INFO) @@ -38,12 +39,8 @@ def on_message(self, message): # separate parameters. But in the version I'm using, the message # is an object that contains body and headers ob = json.loads(message.body) - logger.info(f"Received message: {ob['status']}") - # if (ob["status"] == "STARTED"): - if ob[DIAMOND_STATUS_KEY] == "COMPLETE": - print(ob) - self.messages.append(ob[DIAMOND_FILEPATH_KEY]) - + logger.info(f"Received message: {ob}") + self.messages.append(ob['filePath']) def start_consumer(): tiled_config = get_tiled_config(TILED_INGEST_TILED_CONFIG_PATH)