[SOLVED] Development question: Is there a messaging service in ESH?

Hello everyone,

I’d like to ask if there is a messaging service in OpenHAB/ESH because I have the following use case:
I have a bridge which communicate using it’s handler to the external system via IP interface.
It collects data in local caches which are available for the other things handlers.
The other things are logical representations of various entities in the external system but they get their data from updated by the bridge handler cache.
Currently every handler has it’s own schedule to check for updated data the cache.
It would be much more efficient and cleaner if handlers can subscribe for particular events so when the bridge handler updates the cache, all other handlers will know that there is updated data and they can refresh their own stuff.

What is the proper way to achieve this in OpenHAB/ESH?

Thanks in advance,
K.

The bridge has a list of all things attached. The general pattern is for the bridge to iterate over this list and call some variant of a refresh method on the thing. This might include passing the data or some information what data is updated or on the refresh trigger the thing will ask the bridge for the data.

1 Like

Hi Hilbrand,
Thanks a lot for the explanation.
I’ve done this through the handleCommand() method.
Works like a charm.

Best regards,
Konstantin