70 lines
1.7 KiB
Markdown
70 lines
1.7 KiB
Markdown
## Endpoint数据结构
|
||
|
||
### 数据库表结构
|
||
|
||
```mysql
|
||
|
||
CREATE TABLE `endpoint` (
|
||
`id` bigint unsigned NOT NULL AUTO_INCREMENT,
|
||
`name` varchar(191) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '' COMMENT '名称,路由时基于名称',
|
||
`title` varchar(191) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '' COMMENT '序列号',
|
||
`type` varchar(60) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT '' COMMENT '类型',
|
||
`config_json` text CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci COMMENT '配置信息,基于json格式存储',
|
||
`status` smallint NOT NULL DEFAULT '-1',
|
||
`creator` smallint NOT NULL DEFAULT '0' COMMENT '创建人',
|
||
`created_at` timestamp NULL DEFAULT NULL,
|
||
`updated_at` timestamp NULL DEFAULT NULL,
|
||
PRIMARY KEY (`id`),
|
||
KEY `idx_name` (`name`)
|
||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci
|
||
|
||
```
|
||
|
||
### config_json中的数据配置
|
||
|
||
#### http方式: type=http
|
||
```json
|
||
|
||
{
|
||
"url": "http(s)://www.test.com/api",
|
||
"pool_size": 10
|
||
}
|
||
|
||
```
|
||
|
||
#### mqtt方式, type=mqtt
|
||
```json
|
||
|
||
{
|
||
"host": "127.0.0.1",
|
||
"port": 3361,
|
||
"client_id": "ClientIdOfMqtt",
|
||
"username": "root",
|
||
"password": "Password1234",
|
||
"topic": "mqtt_topic",
|
||
"qos": 0
|
||
}
|
||
|
||
```
|
||
|
||
#### kafka方式, type=kafka
|
||
其中sasl_config可以不配置
|
||
```json
|
||
|
||
{
|
||
"bootstrap_servers": ["127.0.0.1:9090", "192.168.1.1:9090"],
|
||
"topic": "KafkaTopic",
|
||
"sasl_config": {
|
||
"username": "root",
|
||
"password": "password1234",
|
||
"mechanism": "sha_256|sha_512|plain"
|
||
}
|
||
}
|
||
```
|
||
|
||
### 关于name的规则说明
|
||
```text
|
||
边缘端的微服务在数据上传的时候需要指定routing_key, 服务器端收到数据后会根据 routing_key = name 对数据进行路由
|
||
|
||
```
|