EdgeX Message Bus action
**Please notice that, if you’re using the ZeorMQ message bus, the action will create a NEW EdgeX message bus (with the address where running Kuiper service), but not by leveraging the original message bus (normally it’s the address & port exposed by application service). **
Also, you need to expose the port number to host server before running the Kuiper server if you want to have the service available to other hosts.
- optional
- ClientId
- Username
- Password
- Qos
- KeepAlive
- Retained
- ConnectionPayload
- CertFile
- KeyFile
- CertPEMBlock
- KeyPEMBlock
- SkipCertVerify
In this case, the original metadata value (such as id, pushed, created, modified, origin
in Events
structure, and id, created, modified, origin, pushed, device
in Reading
structure will not be kept). Kuiper acts as another EdgeX micro service here, and it has own device name
. A deviceName
property is provided, and allows user to specify the device name of Kuiper. Below is one example,
- Data received from EdgeX message bus
events
topic,
- Use following rule, and specify
deviceName
withkuiper
inedgex
action.
{
"sql": "SELECT temperature * 3 AS t1, humidity FROM events",
"actions": [
{
"protocol": "tcp",
"host": "*",
"port": 5571,
"topic": "application",
"deviceName": "kuiper",
"contentType": "application/json"
}
}
]
}
- The data sent to EdgeX message bus.
Please notice that,
- The device name of
Event
structure is changed tokuiper
- All of metadata for
Events and Readings
structure will be updated with new value.Created
field is updated to another value generated by Kuiper (here is0
).
Publish result to a new EdgeX message bus with keeping original metadata
Below is an example,
- Data received from EdgeX message bus
events
topic,
{
"Device": "demo", "Created": 000, …
[
{"Name": "Temperature", value: "30", "Created":123 …},
{"Name": "Humidity", value: "20", "Created":456 …}
]
- Use following rule, and specify
metadata
withedgex_meta
inedgex
action.
Please notice that,
- User need to add
meta(*) AS edgex_meta
in the SQL clause, themeta(*)
returns all of metadata. - In
edgex
action, valueedgex_meta
is specified formetadata
property. This property specifies which field contains metadata of message.
- The data sent to EdgeX message bus.
{
"Device": "demo", "Created": 000, …
"readings":
[
{"Name": "t1", value: "90" , "Created": 0 …},
{"Name": "humidity", value: "20", "Created":456 …}
]
}
- The metadata of
Events
structure is still kept, such asDevice
&Created
. - For the reading that can be found in original message, the metadata will be kept. Such as
humidity
metadata will be theold values
received from EdgeX message bus. - For the reading that can NOT be found in original message, the metadata will not be set. Such as metadata of
t1
in the sample will fill with default value that generated by Kuiper.
Send result to MQTT message bus
Below is a rule that send analysis result to MQTT message bus, please notice how to specify in optional
configuration.