Configuring connections and forwarders
The Amlen Bridge forwards messages from a source MQTT server to a destination MQTT server. You must specify the source and destination connections and forwarders by using the connections.
You do this by creating a topic map. For more information, see Topic mapping.
Connection properties
After the admin endpoint is configured, the configuration can be changed by using REST APIs or by directly updating the configuration file.
MQTT source and MQTT destination can use the same set of properties which are contained in a "Connection" object. Each connection must have a unique name.
For a description of connection object properties, see Configuring the Bridge.
{
"Connection": {
"WIoTP": {
"MQTTServerList": [ "192.168.26.128:8883" ], /* IP address of the primary */
"TLS": "TLSv1.2",
"Version": "5.0", /* MQTT version */
"ClientID": "A:x:myapp:Inst", /* v5 shared subscription prefix */
"SessionExpiry": 0,
"MaxPacketSize": 64768
}
}
}
{
"Connection": {
"EventStream": {
"EventStreamsBrokerList": [ "192.168.26.128:9093" ],
"TLS": "TLSv1.2",
}
}
}
Forwarder properties
Forwarder properties use the source and destination connection definitions to specify the Bridge. Two useful features are messaging filtering and the ability to define the message topic mapping to automatically handle the topic difference between the source message and destination message. The following example shows the forwarder defined with name m2w:
{
"Forwarder": {
"m2w": {
"Topic": ["wiotp/event/+/+/MyEvent/#"],
"Enabled": true,
"Source": "MyServer",
"Destination": "WIoTP",
"TopicMap": "iot-2/type/${Topic2}/id/${Topic3}/evt/${Topic4}/fmt/json"
}
}
}
For a description of forwarder object properties, see Configuring the Bridge.
In the previous section, source connection MyServer and destination connection WIoTP are defined. Forwarder m2w is defined based on the connections to filter the message and map the topic.
Using admin REST APIs
curl -u "admin:admin" -X POST -k --data '{"Connection": {"WIoTP":
{ "MQTTServerList": [ "192.168.26.128:8883" ], "TLS": "TLSv1.2", "Version": "5.0",
"ClientID": "A:x:myapp:Inst", "SessionExpiry": 0, "MaxPacketSize": 64768} }}'
"https://localhost:9081/admin/config"
where a connection object with name WIoTP is posted to https://127.0.0.1:9961/admin/config with JSON format. The JSON data structure is the same as the structure in bridge.cfg.
curl -u "admin:admin" -X POST -k --data '{"Forwarder":
{ "m2w": { "Topic": ["wiotp"], "Enabled": true, "Source": "MyServer",
"Destination": "WIoTP", "TopicMap": "iot-2" }}}'
"https://localhost:9081/admin/config"
where a forwarder object with name m2w is posted to https://127.0.0.1:9961/admin/config with JSON format. The JSON data structure is the same as the structure in bridge.cfg.