You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@edgent.apache.org by ddebrunner <gi...@git.apache.org> on 2016/04/02 00:28:51 UTC

[GitHub] incubator-quarks pull request: Rework IotfSensors to separate Hear...

GitHub user ddebrunner opened a pull request:

    https://github.com/apache/incubator-quarks/pull/67

    Rework IotfSensors to separate Heartbeat functionality

    

You can merge this pull request into a Git repository by running:

    $ git pull https://github.com/ddebrunner/incubator-quarks iotsensors-heartbeat

Alternatively you can review and apply these changes as the patch at:

    https://github.com/apache/incubator-quarks/pull/67.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

    This closes #67
    
----
commit 2b5c971df39f6bb2e95b4350f8b343ed70b5c592
Author: Dan Debrunner <dj...@debrunners.com>
Date:   2016-04-01T22:16:03Z

    Rework IotfSensors to separate Heartbeat functionality

----


---
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.
---

[GitHub] incubator-quarks pull request: Rework IotfSensors to separate Hear...

Posted by dlaboss <gi...@git.apache.org>.
Github user dlaboss commented on a diff in the pull request:

    https://github.com/apache/incubator-quarks/pull/67#discussion_r58380932
  
    --- Diff: samples/connectors/src/main/java/quarks/samples/connectors/iotf/IotfSensors.java ---
    @@ -109,6 +99,31 @@ public static void simulatedSensors(IotDevice device, boolean print) {
             // with event identifier "sensors".
             device.events(sensors, "sensors", QoS.FIRE_AND_FORGET);
         }
    +    
    +    /**
    +     * Create a heart beat device event with
    +     * identifier {@code heartbeat} to
    +     * ensure there is some immediate output and
    +     * the connection to IoTF happens as soon as possible.
    +     * @param device IoT device
    +     */
    +    public static void heartBeat(IotDevice device, boolean print) {
    --- End diff --
    
    Wondering about promoting (unncessary?) heartbeat messages.  While IotDevice isn't necessarily MQTT specific, MQTT has inherent mechanisms for dealing with this sort of thing:  KeepAlive and LastWillAndTestament.  Discussions [here-on-stackoverflow](http://stackoverflow.com/questions/17270863/mqtt-what-is-the-purpose-or-usage-of-last-will-testament) and [here-on-hivemq](http://www.hivemq.com/blog/mqtt-essentials-part-9-last-will-and-testament). Perhaps IotDevice should include an interface for expressing this and impls do what's needed to comply?


---
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.
---

[GitHub] incubator-quarks pull request: Rework IotfSensors to separate Hear...

Posted by ddebrunner <gi...@git.apache.org>.
Github user ddebrunner commented on a diff in the pull request:

    https://github.com/apache/incubator-quarks/pull/67#discussion_r58384180
  
    --- Diff: samples/connectors/src/main/java/quarks/samples/connectors/iotf/IotfSensors.java ---
    @@ -109,6 +99,31 @@ public static void simulatedSensors(IotDevice device, boolean print) {
             // with event identifier "sensors".
             device.events(sensors, "sensors", QoS.FIRE_AND_FORGET);
         }
    +    
    +    /**
    +     * Create a heart beat device event with
    +     * identifier {@code heartbeat} to
    +     * ensure there is some immediate output and
    +     * the connection to IoTF happens as soon as possible.
    +     * @param device IoT device
    +     */
    +    public static void heartBeat(IotDevice device, boolean print) {
    --- End diff --
    
    Any thoughts on how this sample method comment could be improved to not promote its use? It does already state what the purpose of the heartbeat is for this sample.
    
    Not also that a heartbeat device event performs a somewhat different role to KeepAlive/LastWillAndTestament in that subscribers have visibility to the "I'm still connected" events


---
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.
---

[GitHub] incubator-quarks pull request: Rework IotfSensors to separate Hear...

Posted by dlaboss <gi...@git.apache.org>.
Github user dlaboss commented on a diff in the pull request:

    https://github.com/apache/incubator-quarks/pull/67#discussion_r58390932
  
    --- Diff: samples/connectors/src/main/java/quarks/samples/connectors/iotf/IotfSensors.java ---
    @@ -109,6 +99,31 @@ public static void simulatedSensors(IotDevice device, boolean print) {
             // with event identifier "sensors".
             device.events(sensors, "sensors", QoS.FIRE_AND_FORGET);
         }
    +    
    +    /**
    +     * Create a heart beat device event with
    +     * identifier {@code heartbeat} to
    +     * ensure there is some immediate output and
    +     * the connection to IoTF happens as soon as possible.
    +     * @param device IoT device
    +     */
    +    public static void heartBeat(IotDevice device, boolean print) {
    --- End diff --
    
    I guess the comment could just add something like "If you are using an MQTT-based IotDevice, you may want to consider using the MQTT KeepAlive and LastWillAndTestament mechanisms instead of an explicit heartbeat."  ?
    
    It's true that this heartbeat provides a visible last-heartbeat-timestamp to clients.  However, a visible&reliable "I'm still connected" status seems to be possible using just the KA/LWT.  
    
    That HiveMQ reference suggests: with a "retained" LWT to a topic "status" with the value "offline", the device initially sends a *single* retained msg "online" to that topic.  Clients will see/receive "online" until the device is no longer connected, at which point they will receive "offline" (by virtue of the KA-induced LWT).  I think there's also an implied: upon graceful shutdown, the device sends a single retained "offline" to "status".
    
    Regardless, should an issue be created to discuss (or track) adding something to IotDevice for this higher level concept/feature, and to the MqttDevice and IotfDevice impls? Don't know if something like this is already part of the Watson IoT framework.


---
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.
---

[GitHub] incubator-quarks pull request: Rework IotfSensors to separate Hear...

Posted by asfgit <gi...@git.apache.org>.
Github user asfgit closed the pull request at:

    https://github.com/apache/incubator-quarks/pull/67


---
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.
---

[GitHub] incubator-quarks pull request: Rework IotfSensors to separate Hear...

Posted by ddebrunner <gi...@git.apache.org>.
Github user ddebrunner commented on a diff in the pull request:

    https://github.com/apache/incubator-quarks/pull/67#discussion_r58391713
  
    --- Diff: samples/connectors/src/main/java/quarks/samples/connectors/iotf/IotfSensors.java ---
    @@ -109,6 +99,31 @@ public static void simulatedSensors(IotDevice device, boolean print) {
             // with event identifier "sensors".
             device.events(sensors, "sensors", QoS.FIRE_AND_FORGET);
         }
    +    
    +    /**
    +     * Create a heart beat device event with
    +     * identifier {@code heartbeat} to
    +     * ensure there is some immediate output and
    +     * the connection to IoTF happens as soon as possible.
    +     * @param device IoT device
    +     */
    +    public static void heartBeat(IotDevice device, boolean print) {
    --- End diff --
    
    I guess I'm saying that some applications may have a role for a heartbeat that cannot be implemented by KA/LWT, in that the heartbeat (not this implementation) can contain up to date information about a device.


---
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.
---