[
https://issues.apache.org/jira/browse/QUARKS-217?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15373354#comment-15373354
]
ASF GitHub Bot commented on QUARKS-217:
---------------------------------------
Github user dlaboss commented on a diff in the pull request:
https://github.com/apache/incubator-quarks/pull/156#discussion_r70490355
--- 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 --
Actually, don't know what motivated me to express it that way. I'll
simplify it.
> promote IoT device heart beat to a connector utility
> ----------------------------------------------------
>
> Key: QUARKS-217
> URL: https://issues.apache.org/jira/browse/QUARKS-217
> Project: Quarks
> Issue Type: New Feature
> Components: Connectors
> Reporter: Dale LaBossiere
> Assignee: Dale LaBossiere
> Priority: Minor
>
> Promote the IotDevice heart beat utility present in the IotSensors sample to
> make it reusable.
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)