Interface ThingChangeRegistration

    • Method Detail

      • registerForThingChanges

        void registerForThingChanges​(java.lang.String registrationId,
                                     java.util.function.Consumer<ThingChange> handler)
        Registers a Consumer which is notified about ThingChanges.

        If registered for a specific Thing, it will only be notified of changes of that specific Thing. Otherwise, it will receive changes of all Things.

        Example:
         DittoClient client = ...
         ThingHandle myThing = client.twin().forId("myThing");
        
         myThing.registerForThingChanges(HANDLER_ID, thingChange -> LOGGER.info("change received: {}", thingChange));
         
        Parameters:
        registrationId - an arbitrary ID provided by the user which can be used to cancel the registration later on. The registrationId needs to be unique per DittoClient instance.
        handler - the Consumer to handle change notifications.
        Throws:
        DuplicateRegistrationIdException - if a handler is already registered for the given registrationId.