public abstract class AbstractMqttApplication extends AbstractApplication
Application instances need to:
AbstractApplication.buildTopology(Topology)
AbstractApplication.run()
to build and submit the topology for execution.The class provides some common processing needs:
TopologyProviderFactory
ApplicationUtilities
MqttDevice
props, propsPath, t
Constructor and Description |
---|
AbstractMqttApplication(java.lang.String propsPath) |
Modifier and Type | Method and Description |
---|---|
java.lang.String |
commandId(java.lang.String sensorId,
java.lang.String commandId)
Compose a MqttDevice commandId for the sensor
|
java.lang.String |
getCommandValueString(com.google.gson.JsonObject jo)
Extract a simple string valued command arg
from a
MqttDevice.commands(String...) returned
JsonObject tuple. |
MqttDevice |
mqttDevice()
Get the application's MqttDevice
|
protected void |
preBuildTopology(Topology t)
A hook for a subclass to do things prior to the invocation
of
AbstractApplication.buildTopology(Topology) . |
java.lang.String |
sensorEventId(java.lang.String sensorId,
java.lang.String eventId)
Compose a MqttDevice eventId for the sensor.
|
buildTopology, config, handleRuntimeError, run, utils
public AbstractMqttApplication(java.lang.String propsPath) throws java.lang.Exception
java.lang.Exception
protected void preBuildTopology(Topology t)
AbstractApplication
AbstractApplication.buildTopology(Topology)
.
The default implementation is a no-op.
preBuildTopology
in class AbstractApplication
t
- the application's topologypublic MqttDevice mqttDevice()
public java.lang.String sensorEventId(java.lang.String sensorId, java.lang.String eventId)
sensorId
- the sensor ideventId
- the sensor's eventIdpublic java.lang.String commandId(java.lang.String sensorId, java.lang.String commandId)
sensorId
- the sensor idcommandId
- the sensor's commandIdpublic java.lang.String getCommandValueString(com.google.gson.JsonObject jo)
MqttDevice.commands(String...)
returned
JsonObject tuple.
Interpret the JsonObject's embedded payload as a JsonObject with a single "value" property.
jo
- the command tuple.Copyright © 2016 The Apache Software Foundation. All Rights Reserved - bbe71fa-20161201-1641