SoftwareAG / cumulocity-dynamic-mapper

The ultimate Mapper for building the bridge between any Message Broker and Cumulocity IoT in a zero-code approach!
Apache License 2.0
9 stars 9 forks source link

Subscribing to inactive mapping #102

Closed switschel closed 2 months ago

switschel commented 2 months ago

Currently the mapper subscribes to topics even the mapping is not activated.

sagIoTPower commented 2 months ago

This is due the current implementation and concept that multiple mappings (different mappingTopic) could be linked to the same subscription (same subscriptionTopic).

activating/deactivating a mapping means that the messages are still received but not processed.

An other case where two mappings listen to the same topic is the following:

  1. mapping-event subscribes to topic panel
  2. mapping-alarm subscribes to topic panel

They both consume the same messages but process them differently.

If you deactivate mapping-event and unsubscribe from panel, the other mapping mapping-alarm is deactivated as well. Which might not be what you want.

switschel commented 2 months ago

We could come up with a logic that checks if there is any mapping active that subscribes on a topic and if so only start subscribing on that topic and vice versa if there is no other mapping active that subscribes on that topic we just unsubscribe.

But I would see that as a nice-to-have feature, so low priority currently.

sagIoTPower commented 2 months ago

Changed the implementation to only subscribe to a topic if any mapping is active. Changes are included in: a4a6c4993730075893d0b73efe0a70e4c4a02f9a Could you pls. test if this fixes the issue?