Skip to content

Commit

Permalink
fix for issue 750 (#751)
Browse files Browse the repository at this point in the history
  • Loading branch information
maaikelimper authored Aug 23, 2024
1 parent aed69ad commit d1dca89
Showing 1 changed file with 5 additions and 7 deletions.
12 changes: 5 additions & 7 deletions wis2box-management/wis2box/pubsub/subscribe.py
Original file line number Diff line number Diff line change
Expand Up @@ -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'],
Expand Down

0 comments on commit d1dca89

Please sign in to comment.