Github user saurabhjinturkar commented on a diff in the pull request:
https://github.com/apache/incubator-quarks/pull/154#discussion_r68724628
--- Diff:
connectors/mqtt/src/main/java/quarks/connectors/mqtt/iot/MqttDevice.java ---
@@ -45,7 +45,21 @@ Licensed to the Apache Software Foundation (ASF) under
one
* The connector doesn't presume a particular pattern for
* Device MQTT "event" topic and "command" topics though default
* patterns are provided.
+ * </p>
* <p>
+ * MqttDevice supports payload in String and Json formats.
+ * For command messages, JsonObject is returned with structure as follows:
+ * <br>
+ * <pre>
+ * {
+ * "command" : "<<Command is extracted from command topic provided in
config file>>",
+ * "tsms" : "<<Current time stamp in milliseconds>>",
+ * "format" : "<<json or string provided in command topic>>",
+ * "payload" : "<<Actual payload as JsonObject or String>>"
+ * }
+ * </pre>
+ * <br><br>
+ * </p>
--- End diff --
I am new to Java streams and lambdas; after many iterations of code reading
and attempts to understand the workflow, I have following questions. I am sorry
if they are trivial.
1. The constructor throws IllegalArgumentException (Line 165 & 168) for
both event and command topics if they do not end with _/fmt/json_. As per my
understanding, this will restrict payload format as JSON. We are checking if
topic to decide payload format. Right?
2. Do we have any sample config file which I can refer and try running this
code?
3. Events method requires eventId and qos as parameters, which then calls
events method and pass functions to calculate eventId, payload and qos (Line
224-239). However, eventId and qos are independent of JsonObject for payload.
That means, JsonObject is published as it is. Is my understanding correct? If
yes, in that case, events method does not require payload format specification.
---
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 [email protected] or file a JIRA ticket
with INFRA.
---