Details
-
Wish
-
Status: Open
-
Minor
-
Resolution: Unresolved
-
None
-
None
-
None
Description
Publishing of device events requires using IotDevice.events() which takes a TStream of events to be published. That requires me to introduce a TStream variable even when I don't otherwise need one.
An example of the kind of thing I'd like to be able to write:
IotDevice device = new IotpDevice(...); AtomicInteger sensorState = new AtomicInteger(); ... topology.poll(readSensor, 1, SECONDS) .filter(val -> val != sensorState.getAndSet(val)) // only publish changes .map(val -> toJsonObject(val)) .sink(device.eventConsumer("myEventId", QoS.AT_LEAST_ONCE));
device.eventConsumer() returns a new Consumer<JsonObject>