Interface ThingChangeRegistration
-
- All Superinterfaces:
HandlerDeregistration
- All Known Subinterfaces:
CommonManagement<T,F>
,Live
,LiveThingHandle
,ThingHandle<F>
,Twin
,TwinThingHandle
- All Known Implementing Classes:
CommonManagementImpl
,LiveImpl
,LiveThingHandleImpl
,ThingHandleImpl
,TwinImpl
,TwinThingHandleImpl
public interface ThingChangeRegistration extends HandlerDeregistration
Provides the functionality for registering handlers which are notified aboutThing
changes.- Since:
- 1.0.0
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description void
registerForThingChanges(java.lang.String registrationId, java.util.function.Consumer<ThingChange> handler)
Registers aConsumer
which is notified aboutThingChange
s.-
Methods inherited from interface org.eclipse.ditto.client.registration.HandlerDeregistration
deregister
-
-
-
-
Method Detail
-
registerForThingChanges
void registerForThingChanges(java.lang.String registrationId, java.util.function.Consumer<ThingChange> handler)
Registers aConsumer
which is notified aboutThingChange
s.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. TheregistrationId
needs to be unique perDittoClient
instance.handler
- theConsumer
to handle change notifications.- Throws:
DuplicateRegistrationIdException
- if a handler is already registered for the givenregistrationId
.
-
-