edgent-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Dale LaBossiere (JIRA)" <j...@apache.org>
Subject [jira] [Created] (EDGENT-394) Wish I could use IotDevice.events in a "fluent" style
Date Mon, 13 Mar 2017 21:10:41 GMT
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)

Mime
View raw message