Dale LaBossiere created EDGENT-394:
--------------------------------------
Summary: Wish I could use IotDevice.events in a "fluent" style
Key: EDGENT-394
URL: https://issues.apache.org/jira/browse/EDGENT-394
Project: Edgent
Issue Type: Wish
Components: Connectors
Reporter: Dale LaBossiere
Priority: Minor
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:
{code}
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));
{code}
device.eventConsumer() returns a new {{Consumer<JsonObject>}}
--
This message was sent by Atlassian JIRA
(v6.3.15#6346)