Interface ThingAttributeChangeRegistration
-
- 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 ThingAttributeChangeRegistration extends HandlerDeregistration
Provides the necessary functionality for registering handlers which are notified about attribute changes.- Since:
- 1.0.0
-
-
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description default void
registerForAttributeChanges(java.lang.String registrationId, java.lang.CharSequence path, java.util.function.Consumer<Change> handler)
Registers aConsumer
which is notified about specific attribute changes.void
registerForAttributeChanges(java.lang.String registrationId, org.eclipse.ditto.json.JsonPointer path, java.util.function.Consumer<Change> handler)
Registers aConsumer
which is notified about specific attribute changes.void
registerForAttributesChanges(java.lang.String registrationId, java.util.function.Consumer<Change> handler)
Registers aConsumer
which is notified about allattribute
changes.-
Methods inherited from interface org.eclipse.ditto.client.registration.HandlerDeregistration
deregister
-
-
-
-
Method Detail
-
registerForAttributesChanges
void registerForAttributesChanges(java.lang.String registrationId, java.util.function.Consumer<Change> handler)
Registers aConsumer
which is notified about allattribute
changes.If registered for a specific Thing, it will be notified of all attribute changes of that Thing. Otherwise, it will receive all attribute changes of all Things.
Example:DittoClient client = ... ThingHandle myThing = client.twin().forId("myThing"); myThing.registerForAttributeChanges(HANDLER_ID, change -> LOGGER.info("attributeChange received: {}", change));
- Parameters:
registrationId
- an arbitrary ID provided by the user which can be used to cancel the registration later on. It is required to be unique perDittoClient
instance.handler
- theConsumer
to handle attribute change notifications.- Throws:
DuplicateRegistrationIdException
- if a handler is already registered for the givenregistrationId
.
-
registerForAttributeChanges
default void registerForAttributeChanges(java.lang.String registrationId, java.lang.CharSequence path, java.util.function.Consumer<Change> handler)
Registers aConsumer
which is notified about specific attribute changes.If registered for a specific Thing, it will be notified of attribute changes of that Thing. Otherwise, it will receive attribute changes of all Things.
Example:DittoClient client = ... ThingHandle myThing = client.twin().forId("myThing"); myThing.registerForAttributeChanges(HANDLER_ID, "address/city", change -> LOGGER.info("attributeChange received: {}", change));
- Parameters:
registrationId
- an arbitrary ID provided by the user which can be used to cancel the registration later on. It is required to be unique perDittoClient
instance.path
- the path to theattribute
entry of interest - may contain"/"
for addressing nested paths in a hierarchy.handler
- theConsumer
to handle attribute change notifications.- Throws:
java.lang.IllegalArgumentException
- ifpath
isnull
or empty.DuplicateRegistrationIdException
- if a handler is already registered for the givenregistrationId
.
-
registerForAttributeChanges
void registerForAttributeChanges(java.lang.String registrationId, org.eclipse.ditto.json.JsonPointer path, java.util.function.Consumer<Change> handler)
Registers aConsumer
which is notified about specific attribute changes.If registered for a specific Thing, it will be notified of attribute changes of that Thing. Otherwise, it will receive attribute changes of all Things.
Example:DittoClient client = ... ThingHandle myThing = client.twin().forId("myThing"); myThing.registerForAttributeChanges(HANDLER_ID, JsonFactory.newPointer("address/city"), change -> LOGGER.info("attributeChange received: {}", change));
- Parameters:
registrationId
- an arbitrary ID provided by the user which can be used to cancel the registration later on. It is required to be unique perDittoClient
instance.path
- the path to theattribute
of interested.handler
- theConsumer
to handle attribute change notifications.- Throws:
java.lang.IllegalArgumentException
- ifpath
isnull
or empty.DuplicateRegistrationIdException
- if a handler is already registered for the givenregistrationId
.
-
-