DPIclimate / broker

3 stars 3 forks source link

Logical mapper to look up mapping based upon message timestamp #7

Open dajtxx opened 1 year ago

dajtxx commented 1 year ago

At present the logical mapper assumes the current mapping is required for any message it processes.

This means old messages cannot be published to the logical mapper for re-processing if there has been a change in device mappings for the physical or logical device since the message was first received, say a month ago.

If the logical mapper used a query like

select l_uid from mappings where p_uid = i and start_ts < msg_ts order by start_ts desc limit 1

then the mapping at the time of the message would be selected.

This is more complicated if the mapping cache enhancement is implemented.

In that case it may be worth including a flag in the message to require this special query to be run so it only comes into effect for known old messages, or each message timestamp must be compared to the cached mapping start time and if the message is older the above query must be used.