diff --git a/wis2box-management/wis2box/pubsub/subscribe.py b/wis2box-management/wis2box/pubsub/subscribe.py index 8b3b5472a..dceee6ecb 100644 --- a/wis2box-management/wis2box/pubsub/subscribe.py +++ b/wis2box-management/wis2box/pubsub/subscribe.py @@ -103,14 +103,12 @@ def handle_publish(self, message): LOGGER.debug('Loading MessageData plugin to publish data from message') # noqa topic_hierarchy = message['channel'] metadata_id = message.get('metadata_id') - # if metadata_id not provided determine from topic_hierarchy + # if metadata_id not provided, log error and return if metadata_id is None: - for key, value in self.data_mappings.items(): - if topic_hierarchy in (value['topic_hierarchy']): - topic_hierarchy = (value['topic_hierarchy']) - metadata_id = key - break - + LOGGER.error('metadata_id not provided in message received on topic wis2box/data/publication') # noqa + # ensure topic_hierarchy starts with 'origin/a/wis2/' + if not topic_hierarchy.startswith('origin/a/wis2/'): + topic_hierarchy = f'origin/a/wis2/{topic_hierarchy}' defs = { 'topic_hierarchy': topic_hierarchy, '_meta': message['_meta'],