You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@edgent.apache.org by dl...@apache.org on 2017/03/02 13:56:47 UTC
[1/3] incubator-edgent git commit: [Edgent-176] document MqttDevice's
MQTT messsage format.
Repository: incubator-edgent
Updated Branches:
refs/heads/master b33d2f58d -> 2907150c5
[Edgent-176] document MqttDevice's MQTT messsage format.
Project: http://git-wip-us.apache.org/repos/asf/incubator-edgent/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-edgent/commit/560e2fda
Tree: http://git-wip-us.apache.org/repos/asf/incubator-edgent/tree/560e2fda
Diff: http://git-wip-us.apache.org/repos/asf/incubator-edgent/diff/560e2fda
Branch: refs/heads/master
Commit: 560e2fda9901031b73b743c0470889225c86d1b7
Parents: ec6ccb2
Author: Dale LaBossiere <dl...@us.ibm.com>
Authored: Tue Feb 28 14:13:32 2017 -0500
Committer: Dale LaBossiere <dl...@us.ibm.com>
Committed: Tue Feb 28 14:13:32 2017 -0500
----------------------------------------------------------------------
.../edgent/connectors/mqtt/iot/MqttDevice.java | 35 +++++++++++++++++++-
1 file changed, 34 insertions(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-edgent/blob/560e2fda/connectors/mqtt/src/main/java/org/apache/edgent/connectors/mqtt/iot/MqttDevice.java
----------------------------------------------------------------------
diff --git a/connectors/mqtt/src/main/java/org/apache/edgent/connectors/mqtt/iot/MqttDevice.java b/connectors/mqtt/src/main/java/org/apache/edgent/connectors/mqtt/iot/MqttDevice.java
index f283607..24d26ba 100644
--- a/connectors/mqtt/src/main/java/org/apache/edgent/connectors/mqtt/iot/MqttDevice.java
+++ b/connectors/mqtt/src/main/java/org/apache/edgent/connectors/mqtt/iot/MqttDevice.java
@@ -43,9 +43,14 @@ import com.google.gson.JsonObject;
* the {@link MqttStreams} connector.
* <p>
* The connector doesn't presume a particular pattern for
- * Device MQTT "event" topic and "command" topics though default
+ * Device MQTT "event" and "command" topics though default
* patterns are provided.
* <p>
+ * The MQTT message content for device events and device messages must be JSON,
+ * but the contents of the JSON are under the control of the collaborating MQTT clients.
+ * See {@link #commands(String...)} and {@link #events(TStream, String, int) events()}
+ * for a description of how MQTT messages are converted to and from stream tuples.
+ * <p>
* Connector configuration Properties fall into two categories:
* <ul>
* <li>MQTT Device abstraction properties</li>
@@ -207,6 +212,15 @@ public class MqttDevice implements IotDevice {
return mqttConfig;
}
+ /**
+ * {@inheritDoc}
+ *
+ * <p>The event is published to the configured MQTT {@code mqttDevice.event.topic.pattern},
+ * as described in the above class documentation, substituting the value returned
+ * by the {@code eventId} function for "{EVENTID}" in the pattern.
+ * The MQTT message's payload is the JSON representation
+ * of the JsonObject stream tuple.
+ */
@Override
public TSink<JsonObject> events(TStream<JsonObject> stream, Function<JsonObject, String> eventId,
UnaryOperator<JsonObject> payload, Function<JsonObject, Integer> qos) {
@@ -218,11 +232,30 @@ public class MqttDevice implements IotDevice {
return connector.publish(stream, topic, payloadFn, qos, jo -> retainEvents);
}
+ /**
+ * {@inheritDoc}
+ *
+ * <p>The event is published to the configured MQTT {@code mqttDevice.event.topic.pattern},
+ * as described in the above class documentation, substituting the {@code eventId} for
+ * "{EVENTID}" in the pattern.
+ * The MQTT message's payload is the JSON representation
+ * of the JsonObject stream tuple.
+ */
@Override
public TSink<JsonObject> events(TStream<JsonObject> stream, String eventId, int qos) {
return events(stream, jo -> eventId, jo -> jo, jo -> qos);
}
+ /**
+ * {@inheritDoc}
+ *
+ * <p>
+ * Subscribes to the configured MQTT {@code mqttDevice.command.topic.pattern}
+ * as described in the above class documentation.
+ * The received MQTT message's payload is required to be JSON.
+ * The message's JSON payload is converted to a JsonObject and
+ * set as the {@code payload} key's value in the stream tuple JsonObject.
+ */
@Override
public TStream<JsonObject> commands(String... commands) {
TStream<JsonObject> all = allCommands();
[3/3] incubator-edgent git commit: Merge pull request #294
Posted by dl...@apache.org.
Merge pull request #294
This closes #294
Project: http://git-wip-us.apache.org/repos/asf/incubator-edgent/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-edgent/commit/2907150c
Tree: http://git-wip-us.apache.org/repos/asf/incubator-edgent/tree/2907150c
Diff: http://git-wip-us.apache.org/repos/asf/incubator-edgent/diff/2907150c
Branch: refs/heads/master
Commit: 2907150c5fe364a842de2b956ab124f4c7ef2ec1
Parents: b33d2f5 c97ee1e
Author: Dale LaBossiere <dl...@us.ibm.com>
Authored: Thu Mar 2 08:56:43 2017 -0500
Committer: Dale LaBossiere <dl...@us.ibm.com>
Committed: Thu Mar 2 08:56:43 2017 -0500
----------------------------------------------------------------------
.../edgent/connectors/mqtt/iot/MqttDevice.java | 37 +++++++++++++++++++-
1 file changed, 36 insertions(+), 1 deletion(-)
----------------------------------------------------------------------
[2/3] incubator-edgent git commit: more tweaks
Posted by dl...@apache.org.
more tweaks
Project: http://git-wip-us.apache.org/repos/asf/incubator-edgent/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-edgent/commit/c97ee1e2
Tree: http://git-wip-us.apache.org/repos/asf/incubator-edgent/tree/c97ee1e2
Diff: http://git-wip-us.apache.org/repos/asf/incubator-edgent/diff/c97ee1e2
Branch: refs/heads/master
Commit: c97ee1e2c8dba09a8075a92ec64da1bb1be641ad
Parents: 560e2fd
Author: Dale LaBossiere <dl...@us.ibm.com>
Authored: Tue Feb 28 14:22:14 2017 -0500
Committer: Dale LaBossiere <dl...@us.ibm.com>
Committed: Tue Feb 28 14:22:14 2017 -0500
----------------------------------------------------------------------
.../java/org/apache/edgent/connectors/mqtt/iot/MqttDevice.java | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-edgent/blob/c97ee1e2/connectors/mqtt/src/main/java/org/apache/edgent/connectors/mqtt/iot/MqttDevice.java
----------------------------------------------------------------------
diff --git a/connectors/mqtt/src/main/java/org/apache/edgent/connectors/mqtt/iot/MqttDevice.java b/connectors/mqtt/src/main/java/org/apache/edgent/connectors/mqtt/iot/MqttDevice.java
index 24d26ba..c038327 100644
--- a/connectors/mqtt/src/main/java/org/apache/edgent/connectors/mqtt/iot/MqttDevice.java
+++ b/connectors/mqtt/src/main/java/org/apache/edgent/connectors/mqtt/iot/MqttDevice.java
@@ -46,8 +46,10 @@ import com.google.gson.JsonObject;
* Device MQTT "event" and "command" topics though default
* patterns are provided.
* <p>
- * The MQTT message content for device events and device messages must be JSON,
- * but the contents of the JSON are under the control of the collaborating MQTT clients.
+ * The MQTT message content for device events and device commands must be JSON.
+ * The contents of the JSON are under the control of the collaborating MQTT clients.
+ * Typically a device to defines its event and command schemas
+ * and the other clients to adapt accordingly.
* See {@link #commands(String...)} and {@link #events(TStream, String, int) events()}
* for a description of how MQTT messages are converted to and from stream tuples.
* <p>