edgent-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ddebrunner <...@git.apache.org>
Subject [GitHub] incubator-quarks pull request #156: QUARKS-217 Promote IotDevice heart beat ...
Date Tue, 05 Jul 2016 18:14:17 GMT
Github user ddebrunner commented on a diff in the pull request:

    https://github.com/apache/incubator-quarks/pull/156#discussion_r69611351
  
    --- Diff: samples/connectors/src/main/java/quarks/samples/connectors/iotf/IotfSensors.java
---
    @@ -119,20 +119,8 @@ public static void simulatedSensors(IotDevice device, boolean print)
{
          * @param print true to print generated heartbeat tuples to System.out.
          */
         public static void heartBeat(IotDevice device, boolean print) {
    -        // In addition create a heart beat event to
    -        // ensure there is some immediate output and
    -        // the connection to IoTF happens as soon as possible.
    -        TStream<Date> hb = device.topology().poll(() -> new Date(), 1, TimeUnit.MINUTES);
    -        // Convert to JSON
    -        TStream<JsonObject> hbj = hb.map(d -> {
    -            JsonObject j = new  JsonObject();
    -            j.addProperty("when", d.toString());
    -            j.addProperty("hearbeat", d.getTime());
    -            return j;
    -        });
    -        if (print)
    -            hbj.print();
    -        device.events(hbj, "heartbeat", QoS.FIRE_AND_FORGET);
    +      HeartBeat.addHeartBeat(device, 1, TimeUnit.MINUTES,
    +          "heartbeat", stream -> { if (print) stream.print(); });
    --- End diff --
    
    Found the use of 'stream' a little confusing, since it's the tuple on the stream, not
the stream itself.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

Mime
View raw message