Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit d5f705d

Browse filesBrowse files
committed
api: Add MQTT PubSub support
1 parent d00701b commit d5f705d
Copy full SHA for d5f705d

9 files changed

+1,671-139Lines changed: 1671 additions & 139 deletions
Expand file treeCollapse file tree
Open diff view settings
Collapse file

‎api/api.md‎

Copy file name to clipboardExpand all lines: api/api.md
+37Lines changed: 37 additions & 0 deletions
  • Display the source diff
  • Display the rich diff
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@
3333
- [Service `AsEndDeviceRegistry`](#ttn.lorawan.v3.AsEndDeviceRegistry)
3434
- [File `lorawan-stack/api/applicationserver_pubsub.proto`](#lorawan-stack/api/applicationserver_pubsub.proto)
3535
- [Message `ApplicationPubSub`](#ttn.lorawan.v3.ApplicationPubSub)
36+
- [Message `ApplicationPubSub.MQTTProvider`](#ttn.lorawan.v3.ApplicationPubSub.MQTTProvider)
3637
- [Message `ApplicationPubSub.Message`](#ttn.lorawan.v3.ApplicationPubSub.Message)
3738
- [Message `ApplicationPubSub.NATSProvider`](#ttn.lorawan.v3.ApplicationPubSub.NATSProvider)
3839
- [Message `ApplicationPubSubFormats`](#ttn.lorawan.v3.ApplicationPubSubFormats)
@@ -42,6 +43,7 @@
4243
- [Message `GetApplicationPubSubRequest`](#ttn.lorawan.v3.GetApplicationPubSubRequest)
4344
- [Message `ListApplicationPubSubsRequest`](#ttn.lorawan.v3.ListApplicationPubSubsRequest)
4445
- [Message `SetApplicationPubSubRequest`](#ttn.lorawan.v3.SetApplicationPubSubRequest)
46+
- [Enum `ApplicationPubSub.MQTTProvider.QoS`](#ttn.lorawan.v3.ApplicationPubSub.MQTTProvider.QoS)
4547
- [Service `ApplicationPubSubRegistry`](#ttn.lorawan.v3.ApplicationPubSubRegistry)
4648
- [File `lorawan-stack/api/applicationserver_web.proto`](#lorawan-stack/api/applicationserver_web.proto)
4749
- [Message `ApplicationWebhook`](#ttn.lorawan.v3.ApplicationWebhook)
@@ -801,6 +803,7 @@ The AsEndDeviceRegistry service allows clients to manage their end devices on th
801803
| `updated_at` | [`google.protobuf.Timestamp`](#google.protobuf.Timestamp) | | |
802804
| `format` | [`string`](#string) | | The format to use for the body. Supported values depend on the Application Server configuration. |
803805
| `nats` | [`ApplicationPubSub.NATSProvider`](#ttn.lorawan.v3.ApplicationPubSub.NATSProvider) | | |
806+
| `mqtt` | [`ApplicationPubSub.MQTTProvider`](#ttn.lorawan.v3.ApplicationPubSub.MQTTProvider) | | |
804807
| `base_topic` | [`string`](#string) | | Base topic name to which the messages topic is appended. |
805808
| `downlink_push` | [`ApplicationPubSub.Message`](#ttn.lorawan.v3.ApplicationPubSub.Message) | | The topic to which the Application Server subscribes for downlink queue push operations. |
806809
| `downlink_replace` | [`ApplicationPubSub.Message`](#ttn.lorawan.v3.ApplicationPubSub.Message) | | The topic to which the Application Server subscribes for downlink queue replace operations. |
@@ -821,6 +824,32 @@ The AsEndDeviceRegistry service allows clients to manage their end devices on th
821824
| `format` | <p>`string.max_len`: `20`</p><p>`string.pattern`: `^[a-z0-9](?:[-]?[a-z0-9]){2,}$`</p> |
822825
| `base_topic` | <p>`string.max_len`: `100`</p> |
823826

827+
### <a name="ttn.lorawan.v3.ApplicationPubSub.MQTTProvider">Message `ApplicationPubSub.MQTTProvider`</a>
828+
829+
The MQTT provider settings.
830+
831+
| Field | Type | Label | Description |
832+
| ----- | ---- | ----- | ----------- |
833+
| `server_url` | [`string`](#string) | | |
834+
| `client_id` | [`string`](#string) | | |
835+
| `username` | [`string`](#string) | | |
836+
| `password` | [`string`](#string) | | |
837+
| `subscribe_qos` | [`ApplicationPubSub.MQTTProvider.QoS`](#ttn.lorawan.v3.ApplicationPubSub.MQTTProvider.QoS) | | |
838+
| `publish_qos` | [`ApplicationPubSub.MQTTProvider.QoS`](#ttn.lorawan.v3.ApplicationPubSub.MQTTProvider.QoS) | | |
839+
| `use_tls` | [`bool`](#bool) | | |
840+
| `tls_ca` | [`bytes`](#bytes) | | The server Root CA certificate. PEM formatted. |
841+
| `tls_client_cert` | [`bytes`](#bytes) | | The client certificate. PEM formatted. |
842+
| `tls_client_key` | [`bytes`](#bytes) | | The client private key. PEM formatted. |
843+
844+
#### Field Rules
845+
846+
| Field | Validations |
847+
| ----- | ----------- |
848+
| `server_url` | <p>`string.uri`: `true`</p> |
849+
| `client_id` | <p>`string.max_len`: `23`</p> |
850+
| `username` | <p>`string.max_len`: `100`</p> |
851+
| `password` | <p>`string.max_len`: `100`</p> |
852+
824853
### <a name="ttn.lorawan.v3.ApplicationPubSub.Message">Message `ApplicationPubSub.Message`</a>
825854

826855
| Field | Type | Label | Description |
@@ -919,6 +948,14 @@ The NATS provider settings.
919948
| ----- | ----------- |
920949
| `pubsub` | <p>`message.required`: `true`</p> |
921950

951+
### <a name="ttn.lorawan.v3.ApplicationPubSub.MQTTProvider.QoS">Enum `ApplicationPubSub.MQTTProvider.QoS`</a>
952+
953+
| Name | Number | Description |
954+
| ---- | ------ | ----------- |
955+
| `AT_MOST_ONCE` | 0 | |
956+
| `AT_LEAST_ONCE` | 1 | |
957+
| `EXACTLY_ONCE` | 2 | |
958+
922959
### <a name="ttn.lorawan.v3.ApplicationPubSubRegistry">Service `ApplicationPubSubRegistry`</a>
923960

924961
| Method Name | Request Type | Response Type | Description |
Collapse file

‎api/api.swagger.json‎

Copy file name to clipboardExpand all lines: api/api.swagger.json
+55Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5697,6 +5697,49 @@
56975697
}
56985698
}
56995699
},
5700+
"ApplicationPubSubMQTTProvider": {
5701+
"type": "object",
5702+
"properties": {
5703+
"server_url": {
5704+
"type": "string"
5705+
},
5706+
"client_id": {
5707+
"type": "string"
5708+
},
5709+
"username": {
5710+
"type": "string"
5711+
},
5712+
"password": {
5713+
"type": "string"
5714+
},
5715+
"subscribe_qos": {
5716+
"$ref": "#/definitions/MQTTProviderQoS"
5717+
},
5718+
"publish_qos": {
5719+
"$ref": "#/definitions/MQTTProviderQoS"
5720+
},
5721+
"use_tls": {
5722+
"type": "boolean",
5723+
"format": "boolean"
5724+
},
5725+
"tls_ca": {
5726+
"type": "string",
5727+
"format": "byte",
5728+
"description": "The server Root CA certificate. PEM formatted."
5729+
},
5730+
"tls_client_cert": {
5731+
"type": "string",
5732+
"format": "byte",
5733+
"description": "The client certificate. PEM formatted."
5734+
},
5735+
"tls_client_key": {
5736+
"type": "string",
5737+
"format": "byte",
5738+
"description": "The client private key. PEM formatted."
5739+
}
5740+
},
5741+
"description": "The MQTT provider settings."
5742+
},
57005743
"ApplicationPubSubNATSProvider": {
57015744
"type": "object",
57025745
"properties": {
@@ -6247,6 +6290,15 @@
62476290
}
62486291
}
62496292
},
6293+
"MQTTProviderQoS": {
6294+
"type": "string",
6295+
"enum": [
6296+
"AT_MOST_ONCE",
6297+
"AT_LEAST_ONCE",
6298+
"EXACTLY_ONCE"
6299+
],
6300+
"default": "AT_MOST_ONCE"
6301+
},
62506302
"PictureEmbedded": {
62516303
"type": "object",
62526304
"properties": {
@@ -6795,6 +6847,9 @@
67956847
"nats": {
67966848
"$ref": "#/definitions/ApplicationPubSubNATSProvider"
67976849
},
6850+
"mqtt": {
6851+
"$ref": "#/definitions/ApplicationPubSubMQTTProvider"
6852+
},
67986853
"base_topic": {
67996854
"type": "string",
68006855
"description": "Base topic name to which the messages topic is appended."
Collapse file

‎api/applicationserver_pubsub.proto‎

Copy file name to clipboardExpand all lines: api/applicationserver_pubsub.proto
+24Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,11 +45,35 @@ message ApplicationPubSub {
4545
// The server connection URL.
4646
string server_url = 1 [(gogoproto.customname) = "ServerURL", (validate.rules).string.uri = true];
4747
}
48+
// The MQTT provider settings.
49+
message MQTTProvider {
50+
string server_url = 1 [(gogoproto.customname) = "ServerURL", (validate.rules).string.uri = true];
51+
string client_id = 2 [(gogoproto.customname) = "ClientID", (validate.rules).string.max_len = 23];
52+
string username = 3 [(validate.rules).string.max_len = 100];
53+
string password = 4 [(validate.rules).string.max_len = 100];
54+
55+
enum QoS {
56+
AT_MOST_ONCE = 0;
57+
AT_LEAST_ONCE = 1;
58+
EXACTLY_ONCE = 2;
59+
}
60+
QoS subscribe_qos = 5 [(gogoproto.customname) = "SubscribeQoS"];
61+
QoS publish_qos = 6 [(gogoproto.customname) = "PublishQoS"];
62+
63+
bool use_tls = 7 [(gogoproto.customname) = "UseTLS"];
64+
// The server Root CA certificate. PEM formatted.
65+
bytes tls_ca = 8 [(gogoproto.customname) = "TLSCA"];
66+
// The client certificate. PEM formatted.
67+
bytes tls_client_cert = 9 [(gogoproto.customname) = "TLSClientCert"];
68+
// The client private key. PEM formatted.
69+
bytes tls_client_key = 10 [(gogoproto.customname) = "TLSClientKey"];
70+
}
4871
// The provider for the PubSub.
4972
oneof provider {
5073
option (validate.required) = true;
5174

5275
NATSProvider nats = 17 [(gogoproto.customname) = "NATS"];
76+
MQTTProvider mqtt = 25 [(gogoproto.customname) = "MQTT"];
5377
};
5478

5579
// Base topic name to which the messages topic is appended.

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.