Command Router: close tenant-scoped links when not needed anymore
The Command Router component creates tenant-scoped command consumer links. With the old command & control handling in the protocol adapters, such links were closed when not needed anymore using the tenant-timeout mechanism (#1188/#1475). In the Command Router component, the tenant-scoped links are currently not getting closed.
Applying an adapted tenant-timeout mechanism is probably difficult. When closing a link, we would have to make sure that in the protocol adapters all command consumer connections are closed as well. Otherwise there could be devices still waiting for commands but not being able to get them until a device subscribes for commands again.
A solution could be using the Device Connection cache data. If no commands (or new subscriptions) for a tenant have been received for some time, the Command Router instance queries the cache for the tenant/device-to-protocolAdapterInstance entries belonging to that tenant. If there are none, the tenant-scoped link can be closed.
One kind of obsolete links could be closed by reacting on "Tenant deleted/disabled" notification messages .
One kind of obsolete links could be closed by reacting on "Tenant deleted/disabled" notification messages .
Is this already implemented?
Is this already implemented?
No, reacting on "Tenant deleted/disabled" (and "all devices of tenant deleted") notification messages in the Command Router isn't implemented yet. This would be straightforward to implement.
I think we can limit this issue here to that. Implementing some kind of tenant-idle check using Device Connection cache data seems quite complex.
I would like to work on this issue.
Resolved via #3387.