Download OpenAPI specification:
EMQX Dedicated REST API
列出目前所有被封禁的客户端 ID、用户名和 IP 地址。
page | integer >= 1 Default: 1 Example: page=1 要获取的结果所在页码。 |
limit | integer [ 1 .. 10000 ] Default: 100 Example: limit=50 每页返回的结果数量。 |
clientid | string 使用精确的客户端 ID 查询封禁规则。 |
username | string 使用精确的用户名查询封禁规则。 |
peerhost | string Example: peerhost=127.0.0.1 使用精确的 IP 地址查询封禁规则。 |
like_clientid | string 使用客户端 ID 正则表达式来匹配查询封禁规则。 |
like_username | string 使用用户名正则表达式来匹配查询封禁规则。 |
like_peerhost | string Example: like_peerhost=127.0.0.1 使用 IP 地址正则表达式来匹配查询封禁规则。 |
like_peerhost_net | string Example: like_peerhost_net=192.1.0.0/16 使用 CIDR 正则表达式来匹配查询封禁规则。 |
{- "data": [
- {
- "as": "username",
- "at": "2021-10-25T21:48:47+08:00",
- "by": "mgmt_api",
- "reason": "Too many requests",
- "until": "2030-11-11T10:24:00+08:00",
- "who": "Banned name"
}
], - "meta": {
- "count": 0,
- "hasnext": true,
- "limit": 50,
- "page": 1
}
}
添加一个客户端 ID、用户名或者 IP 地址到黑名单。
as required | string Enum: "clientid" "username" "peerhost" "clientid_re" "username_re" "peerhost_net" 封禁方式,可以通过客户端 ID、用户名或者 IP 地址等方式进行封禁。 |
integer or string 封禁的起始时间,格式为 rfc3339,默认为发起操作的时间。 | |
by | string 封禁的发起者。 |
reason | string 封禁原因,记录当前对象被封禁的原因。 |
(integer or string) or string Default: "infinity" 封禁的结束时间,格式为 rfc3339,默认值为发起操作的时间 + 1 年。 | |
who required | string 封禁对象,具体的客户端 ID、用户名或者 IP 地址。 |
{- "as": "username",
- "at": "2021-10-25T21:48:47+08:00",
- "by": "mgmt_api",
- "reason": "Too many requests",
- "until": "2030-11-11T10:24:00+08:00",
- "who": "Banned name"
}
{- "data": [
- {
- "as": "username",
- "at": "2021-10-25T21:48:47+08:00",
- "by": "mgmt_api",
- "reason": "Too many requests",
- "until": "2030-11-11T10:24:00+08:00",
- "who": "Banned name"
}
]
}
将一个客户端 ID、用户名或者 IP 地址从黑名单中删除。
as required | string Enum: "clientid" "username" "peerhost" "clientid_re" "username_re" "peerhost_net" Example: username 封禁方式,可以通过客户端 ID、用户名或者 IP 地址等方式进行封禁。 |
who required | string Example: Badass 封禁对象,具体的客户端 ID、用户名或者 IP 地址。 |
{- "code": "NOT_FOUND",
- "message": "string"
}
批量取消订阅
clientid required | string |
topic | string 主题名称。 |
[- {
- "topic": "testtopic/#"
}
]
{- "code": "CLIENTID_NOT_FOUND",
- "message": "string"
}
订阅
clientid required | string |
nl | integer Default: 0 MQTT No Local 选项,控制客户端是否接收自己发布的消息。 |
qos | integer [ 0 .. 2 ] Default: 0 消息服务质量(QoS) |
rap | integer Default: 0 客户端是否按原始发布方式保留 MQTT 保留消息的 Retain 标志。 |
rh | integer Default: 0 保留消息处理(Retain handling)。 |
topic required | string 主题名称。 |
{- "nl": 0,
- "qos": 0,
- "rap": 0,
- "rh": 0,
- "topic": "testtopic/#"
}
{- "clientid": "emqx_clientid_xx128cdhfc",
- "durable": false,
- "nl": 0,
- "node": "emqx@127.0.0.1",
- "qos": 0,
- "rap": 0,
- "rh": 0,
- "topic": "testtopic/1"
}
获取指定客户端的详细信息
clientid required | string |
{- "listener": "tcp:default",
- "subscriptions_max": "infinity",
- "send_cnt": 4,
- "mailbox_len": 0,
- "port": 52571,
- "inflight_cnt": 0,
- "send_msg.dropped": 0,
- "clean_start": true,
- "mqueue_max": 1000,
- "recv_cnt": 4,
- "expiry_interval": 0,
- "mqueue_len": 0,
- "proto_ver": 5,
- "send_msg": 0,
- "send_pkt": 4,
- "send_msg.dropped.expired": 0,
- "is_bridge": false,
- "send_msg.qos2": 0,
- "mqueue_dropped": 0,
- "awaiting_rel_cnt": 0,
- "awaiting_rel_max": 100,
- "enable_authn": true,
- "send_msg.qos1": 0,
- "heap_size": 610,
- "is_persistent": false,
- "keepalive": 60,
- "recv_msg.dropped.await_pubrel_timeout": 0,
- "connected_at": "2024-01-01T12:34:56.789+08:00",
- "send_msg.dropped.too_large": 0,
- "recv_msg.qos1": 0,
- "send_msg.qos0": 0,
- "proto_name": "MQTT",
- "recv_msg.qos2": 0,
- "recv_oct": 49,
- "clientid": "01",
- "recv_msg.dropped": 0,
- "send_oct": 31,
- "durable": false,
- "connected": true,
- "recv_msg.qos0": 0,
- "peerport": 52571,
- "recv_msg": 0,
- "mountpoint": "null",
- "recv_pkt": 4,
- "inflight_max": 32,
- "subscriptions_cnt": 1,
- "username": null,
- "node": "emqx@127.0.0.1",
- "reductions": 6836,
- "created_at": "2024-01-01T12:34:56.789+08:00",
- "send_msg.dropped.queue_full": 0,
- "ip_address": "127.0.0.1"
}
列出客户端
page | integer >= 1 Default: 1 Example: page=1 要获取的结果所在页码。 |
node | string Example: node=emqx@127.0.0.1 节点名称 |
limit | integer [ 1 .. 10000 ] Default: 100 Example: limit=50 每页返回的结果数量。 |
username | Array of strings 客户端连接时使用的用户名称。 |
ip_address | string Example: ip_address=127.0.0.1 客户端的 IP 地址。 |
conn_state | string Enum: "connected" "idle" "disconnected" 客户端的当前连接状态,可能的值包括:connected(已连接)、idle(空闲)、disconnected(已断开)。 |
clean_start | boolean 指示客户端是否使用全新的会话。 |
proto_ver | string 客户端使用的协议版本 |
like_clientid | string 模糊搜索 |
like_username | string 模糊搜索 |
integer or string 按大于或等于的方法搜索客户端会话创建时间,格式为 RFC3339 或时间戳(毫秒)。 | |
integer or string 按小于或等于的方法搜索客户端会话创建时间,格式为 RFC3339 或时间戳(毫秒)。 | |
integer or string 按大于或等于的方法搜索客户端连接创建时间,格式为 RFC3339 或时间戳(毫秒)。 | |
integer or string 按小于或等于的方法搜索客户端连接创建时间,格式为 RFC3339 或时间戳(毫秒)。 | |
clientid | Array of strings 客户端 ID。 |
Array of strings or string Default: "all" 请求在响应中返回的客户端字段,多个字段以逗号分隔。 |
{- "data": [
- {
- "listener": "tcp:default",
- "subscriptions_max": "infinity",
- "send_cnt": 4,
- "mailbox_len": 0,
- "port": 52571,
- "inflight_cnt": 0,
- "send_msg.dropped": 0,
- "clean_start": true,
- "mqueue_max": 1000,
- "recv_cnt": 4,
- "expiry_interval": 0,
- "mqueue_len": 0,
- "proto_ver": 5,
- "send_msg": 0,
- "send_pkt": 4,
- "send_msg.dropped.expired": 0,
- "is_bridge": false,
- "send_msg.qos2": 0,
- "mqueue_dropped": 0,
- "awaiting_rel_cnt": 0,
- "awaiting_rel_max": 100,
- "enable_authn": true,
- "send_msg.qos1": 0,
- "heap_size": 610,
- "is_persistent": false,
- "keepalive": 60,
- "recv_msg.dropped.await_pubrel_timeout": 0,
- "connected_at": "2024-01-01T12:34:56.789+08:00",
- "send_msg.dropped.too_large": 0,
- "recv_msg.qos1": 0,
- "send_msg.qos0": 0,
- "proto_name": "MQTT",
- "recv_msg.qos2": 0,
- "recv_oct": 49,
- "clientid": "01",
- "recv_msg.dropped": 0,
- "send_oct": 31,
- "durable": false,
- "connected": true,
- "recv_msg.qos0": 0,
- "peerport": 52571,
- "recv_msg": 0,
- "mountpoint": "null",
- "recv_pkt": 4,
- "inflight_max": 32,
- "subscriptions_cnt": 1,
- "username": null,
- "node": "emqx@127.0.0.1",
- "reductions": 6836,
- "created_at": "2024-01-01T12:34:56.789+08:00",
- "send_msg.dropped.queue_full": 0,
- "ip_address": "127.0.0.1"
}
], - "meta": {
- "count": 1,
- "hasnext": false,
- "limit": 50,
- "page": 1
}
}
获取指定客户端的订阅列表
clientid required | string |
[- {
- "clientid": "emqx_clientid_xx128cdhfc",
- "durable": false,
- "nl": 0,
- "node": "emqx@127.0.0.1",
- "qos": 0,
- "rap": 0,
- "rh": 0,
- "topic": "testtopic/1"
}
]
取消订阅
clientid required | string |
topic | string 主题名称。 |
{- "topic": "testtopic/#"
}
{- "code": "CLIENTID_NOT_FOUND",
- "message": "string"
}
获取客户端消息队列中的消息。
clientid required | string |
payload | string Default: "base64" Enum: "none" "base64" "plain" 客户端的 Inflight/MQueue 消息的 payload 编码格式。 |
max_payload_bytes | string Default: "1MB" Example: max_payload_bytes=32MB 客户端的未确认消息(inflight)/ 消息队列(mqueue)消息 payload 限制。 |
string or string or string Example: position=none 一个不透明的 token,可用于后续请求以获取下一批结果: | |
limit | integer [ 1 .. 10000 ] Default: 100 Example: limit=50 每页返回的结果数量。 |
{- "data": [
- {
- "from_clientid": "mqttx_59ac0a87",
- "from_username": "test-user",
- "mqueue_priority": 0,
- "msgid": "000611F460D57FA9F44500000D360002",
- "payload": "eyJmb28iOiAiYmFyIn0=",
- "publish_at": 1709055346487,
- "qos": 0,
- "topic": "t/test"
}
], - "meta": {
- "count": 100,
- "last": "1710785444656449826_10"
}
}
批量订阅
clientid required | string |
nl | integer Default: 0 MQTT No Local 选项,控制客户端是否接收自己发布的消息。 |
qos | integer [ 0 .. 2 ] Default: 0 消息服务质量(QoS) |
rap | integer Default: 0 客户端是否按原始发布方式保留 MQTT 保留消息的 Retain 标志。 |
rh | integer Default: 0 保留消息处理(Retain handling)。 |
topic required | string 主题名称。 |
[- {
- "nl": 0,
- "qos": 0,
- "rap": 0,
- "rh": 0,
- "topic": "testtopic/#"
}
]
[- {
- "clientid": "emqx_clientid_xx128cdhfc",
- "durable": false,
- "nl": 0,
- "node": "emqx@127.0.0.1",
- "qos": 0,
- "rap": 0,
- "rh": 0,
- "topic": "testtopic/1"
}
]
获取客户端未确认消息。
clientid required | string |
payload | string Default: "base64" Enum: "none" "base64" "plain" 客户端的 Inflight/MQueue 消息的 payload 编码格式。 |
max_payload_bytes | string Default: "1MB" Example: max_payload_bytes=32MB 客户端的未确认消息(inflight)/ 消息队列(mqueue)消息 payload 限制。 |
string or string or string Example: position=none 一个不透明的 token,可用于后续请求以获取下一批结果: | |
limit | integer [ 1 .. 10000 ] Default: 100 Example: limit=50 每页返回的结果数量。 |
{- "data": [
- {
- "from_clientid": "mqttx_59ac0a87",
- "from_username": "test-user",
- "msgid": "000611F460D57FA9F44500000D360002",
- "payload": "eyJmb28iOiAiYmFyIn0=",
- "publish_at": 1709055346487,
- "qos": 0,
- "topic": "t/test"
}
], - "meta": {
- "count": 100,
- "last": "1710785444656449826"
}
}
在集群的所有节点上启动连接器。
id required | string Example: http:my_http_connector 连接器 id。必须是 {type}:{name} 的格式。 |
operation required | string Value: "start" Example: start 集群可用操作:'start'。 |
{- "code": "BAD_REQUEST",
- "message": "string"
}
测试创建一个新的连接器。
bridge_kafka.auth_gssapi_kerberos (object) or bridge_kafka.auth_username_password (object) or string or string Default: "none" 认证配置。 | |
bootstrap_hosts required | string 用逗号分隔的 |
connect_timeout | string Default: "5s" 建立 TCP 连接时的最大等待时长(若启用认证,这个等待时长也包含完成认证所需时间)。 |
description | string Default: "" 描述性文本。 |
enable | boolean Default: true 启用 (是) 或 停用 (否) 该连接器。 |
metadata_request_timeout | string Default: "5s" 刷新元数据时最大等待时长。 |
min_metadata_refresh_interval | string Default: "3s" 刷新 Kafka broker 和 Kafka 主题元数据段最短时间间隔。设置太小可能会增加 Kafka 压力。 |
name required | string 连接器的名称 |
object (bridge_kafka.connector_resource_opts) | |
object (bridge_kafka.socket_opts) | |
object (bridge_kafka.ssl_client_opts) | |
tags | Array of strings 连接器的标签 |
type required | string Value: "kafka_consumer" 连接器的类型。 |
{- "authentication": {
- "password": "******",
- "username": "root"
}, - "connect_timeout": "15s",
- "description": "My example elasticsearch connector",
- "enable": true,
- "enable_pipelining": 100,
- "name": "elasticsearch_connector",
- "pool_size": 8,
- "pool_type": "random",
- "server": "127.0.0.1:9200",
- "ssl": {
- "enable": false
}, - "type": "elasticsearch"
}
{- "code": "TEST_FAILED",
- "message": "string"
}
在集群的所有节点上启用或禁用连接器。
id required | string Example: http:my_http_connector 连接器 id。必须是 {type}:{name} 的格式。 |
enable required | boolean Example: true 是否启用此连接器。 |
{- "code": "NOT_FOUND",
- "message": "string"
}
通过 id 获取一个连接器。
id required | string Example: http:my_http_connector 连接器 id。必须是 {type}:{name} 的格式。 |
{- "actions": [
- "my_action"
], - "authentication": {
- "password": "******",
- "username": "root"
}, - "connect_timeout": "15s",
- "description": "My example elasticsearch connector",
- "enable": true,
- "enable_pipelining": 100,
- "name": "elasticsearch_connector",
- "node_status": [
- {
- "node": "emqx@localhost",
- "status": "connected"
}
], - "pool_size": 8,
- "pool_type": "random",
- "server": "127.0.0.1:9200",
- "ssl": {
- "enable": false
}, - "status": "connected",
- "type": "elasticsearch"
}
通过 id 更新一个连接器。
id required | string Example: http:my_http_connector 连接器 id。必须是 {type}:{name} 的格式。 |
bridge_kafka.auth_gssapi_kerberos (object) or bridge_kafka.auth_username_password (object) or string or string Default: "none" 认证配置。 | |
bootstrap_hosts required | string 用逗号分隔的 |
connect_timeout | string Default: "5s" 建立 TCP 连接时的最大等待时长(若启用认证,这个等待时长也包含完成认证所需时间)。 |
description | string Default: "" 描述性文本。 |
enable | boolean Default: true 启用 (是) 或 停用 (否) 该连接器。 |
metadata_request_timeout | string Default: "5s" 刷新元数据时最大等待时长。 |
min_metadata_refresh_interval | string Default: "3s" 刷新 Kafka broker 和 Kafka 主题元数据段最短时间间隔。设置太小可能会增加 Kafka 压力。 |
object (bridge_kafka.connector_resource_opts) | |
object (bridge_kafka.socket_opts) | |
object (bridge_kafka.ssl_client_opts) | |
tags | Array of strings 连接器的标签 |
{- "authentication": {
- "password": "******",
- "username": "root"
}, - "connect_timeout": "15s",
- "description": "My example elasticsearch connector",
- "enable": true,
- "enable_pipelining": 100,
- "name": "elasticsearch_connector",
- "pool_size": 8,
- "pool_type": "random",
- "server": "127.0.0.1:9200",
- "ssl": {
- "enable": false
}, - "type": "elasticsearch"
}
{- "actions": [
- "my_action"
], - "authentication": {
- "password": "******",
- "username": "root"
}, - "connect_timeout": "15s",
- "description": "My example elasticsearch connector",
- "enable": true,
- "enable_pipelining": 100,
- "name": "elasticsearch_connector",
- "node_status": [
- {
- "node": "emqx@localhost",
- "status": "connected"
}
], - "pool_size": 8,
- "pool_type": "random",
- "server": "127.0.0.1:9200",
- "ssl": {
- "enable": false
}, - "status": "connected",
- "type": "elasticsearch"
}
[- {
- "actions": [
- "my_action"
], - "authentication": {
- "password": "******",
- "username": "root"
}, - "connect_timeout": "15s",
- "description": "My example elasticsearch connector",
- "enable": true,
- "enable_pipelining": 100,
- "name": "elasticsearch_connector",
- "node_status": [
- {
- "node": "emqx@localhost",
- "status": "connected"
}
], - "pool_size": 8,
- "pool_type": "random",
- "server": "127.0.0.1:9200",
- "ssl": {
- "enable": false
}, - "status": "connected",
- "type": "elasticsearch"
}, - {
- "actions": [
- "my_action"
], - "description": "My example oracle connector",
- "name": "oracle_connector",
- "node_status": [
- {
- "node": "emqx@localhost",
- "status": "connected"
}
], - "password": "oracle",
- "pool_size": 8,
- "resource_opts": {
- "health_check_interval": "15s",
- "start_timeout": "5s"
}, - "server": "127.0.0.1:1521",
- "service_name": "XE",
- "sid": "XE",
- "status": "connected",
- "type": "oracle",
- "username": "system"
}, - {
- "actions": [
- "my_action"
], - "database": "test",
- "description": "My example sqlserver connector",
- "driver": "ms-sql",
- "name": "sqlserver_connector",
- "node_status": [
- {
- "node": "emqx@localhost",
- "status": "connected"
}
], - "password": "******",
- "pool_size": 8,
- "resource_opts": {
- "health_check_interval": "20s"
}, - "server": "127.0.0.1:1433",
- "status": "connected",
- "type": "sqlserver",
- "username": "sa"
}, - {
- "actions": [
- "my_action"
], - "description": "My example hstreamdb connector",
- "grpc_timeout": "30s",
- "name": "hstreamdb_connector",
- "node_status": [
- {
- "node": "emqx@localhost",
- "status": "connected"
}
], - "resource_opts": {
- "health_check_interval": "15s",
- "start_timeout": "5s"
}, - "ssl": {
- "enable": false,
- "verify": "verify_peer"
}, - "status": "connected",
- "type": "hstreamdb",
}, - {
- "actions": [
- "my_action"
], - "description": "My example tdengine connector",
- "enable": true,
- "name": "tdengine_connector",
- "node_status": [
- {
- "node": "emqx@localhost",
- "status": "connected"
}
], - "password": "******",
- "pool_size": 8,
- "server": "127.0.0.1:6041",
- "status": "connected",
- "type": "tdengine",
- "username": "root"
}, - {
- "actions": [
- "my_action"
], - "description": "My example rocketmq connector",
- "enable": true,
- "name": "rocketmq_connector",
- "node_status": [
- {
- "node": "emqx@localhost",
- "status": "connected"
}
], - "pool_size": 8,
- "resource_opts": {
- "health_check_interval": "15s",
- "start_after_created": true,
- "start_timeout": "5s"
}, - "servers": "127.0.0.1:9876",
- "status": "connected",
- "type": "rocketmq"
}, - {
- "actions": [
- "my_action"
], - "authentication": {
- "password": "******",
- "username": "root"
}, - "connect_timeout": "15s",
- "description": "My example iotdb connector",
- "enable": true,
- "enable_pipelining": 100,
- "iotdb_version": "v1.3.x",
- "name": "iotdb_connector",
- "node_status": [
- {
- "node": "emqx@localhost",
- "status": "connected"
}
], - "pool_size": 8,
- "pool_type": "random",
- "ssl": {
- "enable": false
}, - "status": "connected",
- "type": "iotdb"
}, - {
- "actions": [
- "my_action"
], - "description": "My example influxdb connector",
- "enable": true,
- "name": "influxdb_connector",
- "node_status": [
- {
- "node": "emqx@localhost",
- "status": "connected"
}
], - "parameters": {
- "bucket": "example_bucket",
- "influxdb_type": "influxdb_api_v2",
- "org": "examlpe_org",
- "token": "example_token"
}, - "pool_size": 8,
- "server": "127.0.0.1:8086",
- "ssl": {
- "enable": false
}, - "status": "connected",
- "type": "influxdb"
}, - {
- "description": "My redis sentinel connector",
- "enable": true,
- "node_status": [
- {
- "node": "emqx@localhost",
- "status": "connected"
}
], - "parameters": {
- "database": 1,
- "password": "******",
- "pool_size": 8,
- "redis_type": "sentinel",
- "sentinel": "myredismaster",
- "servers": "127.0.0.1:6379,127.0.0.2:6379",
- "username": "test"
}, - "ssl": {
- "enable": false
}, - "status": "connected"
}, - {
- "actions": [
- "my_action"
], - "aws_access_key_id": "root",
- "aws_secret_access_key": "******",
- "description": "My example dynamo connector",
- "enable": true,
- "name": "dynamo_connector",
- "node_status": [
- {
- "node": "emqx@localhost",
- "status": "connected"
}
], - "pool_size": 8,
- "region": "us-west-2",
- "resource_opts": {
- "health_check_interval": "15s",
- "start_timeout": "5s"
}, - "status": "connected",
- "type": "dynamo",
}, - {
- "actions": [
- "my_action"
], - "database": "emqx_data",
- "enable": true,
- "name": "my_timescale_connector",
- "node_status": [
- {
- "node": "emqx@localhost",
- "status": "connected"
}
], - "password": "public",
- "pool_size": 8,
- "server": "127.0.0.1:5432",
- "ssl": {
- "ciphers": [ ],
- "depth": 10,
- "enable": false,
- "hibernate_after": "5s",
- "log_level": "notice",
- "reuse_sessions": true,
- "secure_renegotiate": true,
- "verify": "verify_peer",
- "versions": [
- "tlsv1.3",
- "tlsv1.2"
]
}, - "status": "connected",
- "type": "timescale",
- "username": "postgres"
}, - {
- "description": "My connector",
- "enable": true,
- "node_status": [
- {
- "node": "emqx@localhost",
- "status": "connected"
}
], - "password": "******",
- "resource_opts": {
- "health_check_interval": "45s",
- "start_after_created": true,
- "start_timeout": "5s"
}, - "server": "couchbase:8093",
- "ssl": {
- "enable": true
}, - "status": "connected",
- "username": "admin"
}, - {
- "description": "My connector",
- "enable": true,
- "node_status": [
- {
- "node": "emqx@localhost",
- "status": "connected"
}
], - "pool_size": 3,
- "proto_ver": "v5",
- "resource_opts": {
- "health_check_interval": "45s",
- "start_after_created": true,
- "start_timeout": "5s"
}, - "server": "127.0.0.1:1883",
- "status": "connected"
}, - {
- "actions": [
- "my_action"
], - "description": "My example mongodb_rs connector",
- "name": "mongodb_rs_connector",
- "node_status": [
- {
- "node": "emqx@localhost",
- "status": "connected"
}
], - "parameters": {
- "database": "mqtt",
- "enable": true,
- "password": "******",
- "pool_size": 8,
- "srv_record": false,
- "username": "myuser"
}, - "status": "connected",
- "type": "mongodb_rs"
}, - {
- "description": "My redis single connector",
- "enable": true,
- "node_status": [
- {
- "node": "emqx@localhost",
- "status": "connected"
}
], - "parameters": {
- "database": 1,
- "password": "******",
- "pool_size": 8,
- "redis_type": "single",
- "server": "127.0.0.1:6379",
- "username": "test"
}, - "ssl": {
- "enable": false
}, - "status": "connected"
}, - {
- "actions": [
- "my_action"
], - "dbname": "example_db",
- "description": "My example greptimedb connector",
- "enable": true,
- "local_topic": "local/topic/#",
- "name": "demo",
- "node_status": [
- {
- "node": "emqx@localhost",
- "status": "connected"
}
], - "password": "******",
- "resource_opts": {
- "batch_size": 100,
- "batch_time": "20ms"
}, - "server": "127.0.0.1:4001",
- "ssl": {
- "enable": false
}, - "status": "connected",
- "type": "greptimedb",
- "username": "example_username"
}, - {
- "access_key_id": "ACCESS",
- "description": "My S3 connector",
- "enable": true,
- "host": "s3.eu-east-1.amazonaws.com",
- "node_status": [
- {
- "node": "emqx@localhost",
- "status": "connected"
}
], - "port": 443,
- "secret_access_key": "SECRET",
- "status": "connected",
- "transport_options": {
- "connect_timeout": "1s",
- "enable_pipelining": 1,
- "max_retries": 1,
- "pool_size": 4,
- "request_timeout": "60s",
- "ssl": {
- "enable": true,
- "verify": "verify_peer"
}
}
}, - {
- "actions": [
- "my_action"
], - "database": "mqtt",
- "description": "My example clickhouse connector",
- "name": "clickhouse_connector",
- "node_status": [
- {
- "node": "emqx@localhost",
- "status": "connected"
}
], - "password": "******",
- "pool_size": 8,
- "status": "connected",
- "type": "clickhouse",
- "username": "default"
}, - {
- "actions": [
- "my_action"
], - "connect_timeout": "15s",
- "description": "my connector",
- "enable": true,
- "max_retries": 2,
- "name": "my_connector",
- "node_status": [
- {
- "node": "emqx@localhost",
- "status": "connected"
}
], - "pipelining": 100,
- "pool_size": 8,
- "resource_opts": {
- "health_check_interval": "30s",
- "start_after_created": true,
- "start_timeout": "5s"
}, - "service_account_json": {
- "client_email": "test@myproject.iam.gserviceaccount.com",
- "client_id": "123812831923812319190",
- "client_x509_cert_url": "https://www.googleapis.com/robot/v1/metadata/x509/test%40myproject.iam.gserviceaccount.com",
- "private_key": "-----BEGIN PRIVATE KEY-----\nMIIEvQI...",
- "private_key_id": "kid",
- "project_id": "myproject",
- "type": "service_account"
}, - "status": "connected",
- "type": "gcp_pubsub_producer"
}, - {
- "account_key": "******",
- "account_name": "my_account_name",
- "description": "My connector",
- "enable": true,
- "node_status": [
- {
- "node": "emqx@localhost",
- "status": "connected"
}
], - "resource_opts": {
- "health_check_interval": "45s",
- "start_after_created": true,
- "start_timeout": "5s"
}, - "status": "connected"
}, - {
- "actions": [
- "my_action"
], - "description": "My example rabbitmq connector",
- "enable": true,
- "heartbeat": "30s",
- "name": "rabbitmq_connector",
- "node_status": [
- {
- "node": "emqx@localhost",
- "status": "connected"
}
], - "password": "******",
- "pool_size": 8,
- "port": 5672,
- "server": "127.0.0.1",
- "ssl": {
- "enable": false
}, - "status": "connected",
- "timeout": "5s",
- "type": "rabbitmq",
- "username": "guest",
- "virtual_host": "/"
}, - {
- "access_key_id": "12345",
- "description": "My connector",
- "enable": true,
- "node_status": [
- {
- "node": "emqx@localhost",
- "status": "connected"
}
], - "request_timeout": "10s",
- "resource_opts": {
- "health_check_interval": "45s",
- "start_after_created": true,
- "start_timeout": "5s"
}, - "s3_client": {
- "transport_options": {
- "connect_timeout": "1s",
- "enable_pipelining": 1,
- "max_retries": 1,
- "pool_size": 4,
- "request_timeout": "60s",
- "ssl": {
- "enable": true,
- "verify": "verify_peer"
}
}
}, - "s3tables_arn": "arn:aws:s3tables:sa-east-1:123456789012:bucket/mybucket",
- "secret_access_key": "******",
- "status": "connected"
}, - {
- "actions": [
- "my_action"
], - "description": "My example cassandra connector",
- "keyspace": "mqtt",
- "name": "cassandra_connector",
- "node_status": [
- {
- "node": "emqx@localhost",
- "status": "connected"
}
], - "password": "******",
- "pool_size": 8,
- "servers": "127.0.0.1:9042",
- "status": "connected",
- "type": "cassandra",
- "username": "root"
}, - {
- "ack_mode": "no_ack",
- "ack_timeout": "10s",
- "actions": [
- "my_action"
], - "enable": true,
- "name": "syskeeper_forwarder",
- "node_status": [
- {
- "node": "emqx@localhost",
- "status": "connected"
}
], - "pool_size": 16,
- "server": "127.0.0.1:9092",
- "status": "connected",
- "type": "syskeeper_forwarder"
}, - {
- "actions": [
- "my_action"
], - "description": "My example mongodb_sharded connector",
- "name": "mongodb_sharded_connector",
- "node_status": [
- {
- "node": "emqx@localhost",
- "status": "connected"
}
], - "parameters": {
- "database": "mqtt",
- "enable": true,
- "password": "******",
- "pool_size": 8,
- "srv_record": false,
- "username": "myuser"
}, - "status": "connected",
- "type": "mongodb_sharded"
}, - {
- "acceptors": 16,
- "actions": [
- "my_action"
], - "enable": true,
- "handshake_timeout": "16s",
- "listen": "127.0.0.1:9092",
- "name": "syskeeper_proxy",
- "node_status": [
- {
- "node": "emqx@localhost",
- "status": "connected"
}
], - "status": "connected",
- "type": "syskeeper_proxy"
}, - {
- "connect_timeout": "15s",
- "enable": true,
- "enable_pipelining": 100,
- "headers": {
- "content-type": "application/json"
}, - "name": "my_http_connector",
- "node_status": [
- {
- "node": "emqx@localhost",
- "status": "connected"
}
], - "pool_size": 1,
- "pool_type": "hash",
- "status": "connected",
- "type": "http",
}, - {
- "account": "myorg-myaccount",
- "description": "My connector",
- "dsn": "snowflake",
- "enable": true,
- "node_status": [
- {
- "node": "emqx@localhost",
- "status": "connected"
}
], - "password": "******",
- "pool_size": 8,
- "resource_opts": {
- "health_check_interval": "45s",
- "start_after_created": true,
- "start_timeout": "5s"
}, - "server": "myorg-myaccount.snowflakecomputing.com",
- "status": "connected",
- "username": "admin"
}, - {
- "actions": [
- "my_action"
], - "connect_timeout": "10s",
- "enable": true,
- "max_retries": 2,
- "name": "my_connector",
- "node_status": [
- {
- "node": "emqx@localhost",
- "status": "connected"
}
], - "pipelining": 100,
- "pool_size": 8,
- "resource_opts": {
- "request_ttl": "60s"
}, - "service_account_json": {
- "client_email": "test@myproject.iam.gserviceaccount.com",
- "client_id": "123812831923812319190",
- "client_x509_cert_url": "https://www.googleapis.com/robot/v1/metadata/x509/test%40myproject.iam.gserviceaccount.com",
- "private_key": "-----BEGIN PRIVATE KEY-----\nMIIEvQI...",
- "private_key_id": "kid",
- "project_id": "myproject",
- "type": "service_account"
}, - "status": "connected",
- "type": "gcp_pubsub_producer"
}, - {
- "actions": [
- "my_action"
], - "description": "My example influxdb connector",
- "enable": true,
- "name": "influxdb_connector",
- "node_status": [
- {
- "node": "emqx@localhost",
- "status": "connected"
}
], - "parameters": {
- "database": "example_database",
- "influxdb_type": "influxdb_api_v1",
- "password": "******",
- "username": "example_username"
}, - "pool_size": 8,
- "server": "127.0.0.1:8086",
- "ssl": {
- "enable": false
}, - "status": "connected",
- "type": "influxdb"
}, - {
- "actions": [
- "my_action"
], - "description": "My example datalayers connector",
- "enable": true,
- "name": "datalayers_connector",
- "node_status": [
- {
- "node": "emqx@localhost",
- "status": "connected"
}
], - "parameters": {
- "database": "example_database",
- "password": "******",
- "username": "example_username"
}, - "pool_size": 8,
- "server": "127.0.0.1:8361",
- "ssl": {
- "enable": false
}, - "status": "connected",
- "type": "datalayers"
}, - {
- "actions": [
- "my_action"
], - "authentication": "none",
- "connect_timeout": "5s",
- "description": "My example pulsar connector",
- "enable": true,
- "name": "pulsar_connector",
- "node_status": [
- {
- "node": "emqx@localhost",
- "status": "connected"
}
], - "servers": "pulsar://127.0.0.1:6650",
- "ssl": {
- "enable": false
}, - "status": "connected",
- "type": "pulsar"
}, - {
- "actions": [
- "my_action"
], - "description": "My example mongodb_single connector",
- "name": "mongodb_single_connector",
- "node_status": [
- {
- "node": "emqx@localhost",
- "status": "connected"
}
], - "parameters": {
- "database": "mqtt",
- "enable": true,
- "password": "******",
- "pool_size": 8,
- "srv_record": false,
- "username": "myuser"
}, - "status": "connected",
- "type": "mongodb_single"
}, - {
- "actions": [
- "my_action"
], - "aws_access_key_id": "your_access_key",
- "aws_secret_access_key": "aws_secret_key",
- "description": "My example kinesis connector",
- "max_retries": 2,
- "name": "kinesis_connector",
- "node_status": [
- {
- "node": "emqx@localhost",
- "status": "connected"
}
], - "pool_size": 8,
- "status": "connected",
- "type": "kinesis"
}, - {
- "actions": [
- "my_action"
], - "database": "emqx_data",
- "enable": true,
- "name": "my_pgsql_connector",
- "node_status": [
- {
- "node": "emqx@localhost",
- "status": "connected"
}
], - "password": "public",
- "pool_size": 8,
- "server": "127.0.0.1:5432",
- "ssl": {
- "ciphers": [ ],
- "depth": 10,
- "enable": false,
- "hibernate_after": "5s",
- "log_level": "notice",
- "reuse_sessions": true,
- "secure_renegotiate": true,
- "verify": "verify_peer",
- "versions": [
- "tlsv1.3",
- "tlsv1.2"
]
}, - "status": "connected",
- "type": "pgsql",
- "username": "postgres"
}, - {
- "actions": [
- "my_action"
], - "authentication": {
- "mechanism": "plain",
- "password": "******",
- "username": "username"
}, - "bootstrap_hosts": "localhost:9092",
- "connect_timeout": "5s",
- "enable": true,
- "metadata_request_timeout": "4s",
- "min_metadata_refresh_interval": "3s",
- "name": "my_kafka_producer_connector",
- "node_status": [
- {
- "node": "emqx@localhost",
- "status": "connected"
}
], - "socket_opts": {
- "nodelay": true,
- "recbuf": "1024KB",
- "sndbuf": "1024KB",
- "tcp_keepalive": "none"
}, - "status": "connected",
- "type": "kafka_producer"
}, - {
- "actions": [
- "my_action"
], - "database": "test",
- "description": "My example mysql connector",
- "name": "mysql_connector",
- "node_status": [
- {
- "node": "emqx@localhost",
- "status": "connected"
}
], - "password": "******",
- "pool_size": 8,
- "resource_opts": {
- "health_check_interval": "20s"
}, - "server": "127.0.0.1:3306",
- "status": "connected",
- "type": "mysql",
- "username": "root"
}, - {
- "description": "My redis cluster connector",
- "enable": true,
- "node_status": [
- {
- "node": "emqx@localhost",
- "status": "connected"
}
], - "parameters": {
- "password": "******",
- "pool_size": 8,
- "redis_type": "cluster",
- "servers": "127.0.0.1:6379,127.0.0.2:6379",
- "username": "test"
}, - "ssl": {
- "enable": false
}, - "status": "connected"
}, - {
- "actions": [
- "my_action"
], - "authentication": {
- "password": "******"
}, - "bootstrap_hosts": "xyz.sa-east1.gcp.confluent.cloud:9092",
- "connect_timeout": "5s",
- "enable": true,
- "metadata_request_timeout": "4s",
- "min_metadata_refresh_interval": "3s",
- "name": "my_confluent_producer_connector",
- "node_status": [
- {
- "node": "emqx@localhost",
- "status": "connected"
}
], - "socket_opts": {
- "nodelay": true,
- "recbuf": "1024KB",
- "sndbuf": "1024KB",
- "tcp_keepalive": "none"
}, - "ssl": {
- "enable": true,
- "server_name_indication": "auto",
- "verify": "verify_none",
- "versions": [
- "tlsv1.3",
- "tlsv1.2"
]
}, - "status": "connected",
- "type": "confluent_producer"
}, - {
- "database": "test",
- "description": "My connector",
- "enable": true,
- "node_status": [
- {
- "node": "emqx@localhost",
- "status": "connected"
}
], - "password": "******",
- "pool_size": 8,
- "resource_opts": {
- "health_check_interval": "45s",
- "start_after_created": true,
- "start_timeout": "5s"
}, - "server": "doris-fe:9030",
- "status": "connected",
- "username": "root"
}, - {
- "actions": [
- "my_action"
], - "database": "emqx_data",
- "enable": true,
- "name": "my_matrix_connector",
- "node_status": [
- {
- "node": "emqx@localhost",
- "status": "connected"
}
], - "password": "public",
- "pool_size": 8,
- "server": "127.0.0.1:5432",
- "ssl": {
- "ciphers": [ ],
- "depth": 10,
- "enable": false,
- "hibernate_after": "5s",
- "log_level": "notice",
- "reuse_sessions": true,
- "secure_renegotiate": true,
- "verify": "verify_peer",
- "versions": [
- "tlsv1.3",
- "tlsv1.2"
]
}, - "status": "connected",
- "type": "matrix",
- "username": "postgres"
}, - {
- "actions": [
- "my_action"
], - "authentication": {
- "password": "******"
}, - "bootstrap_hosts": "namespace.servicebus.windows.net:9093",
- "connect_timeout": "5s",
- "enable": true,
- "metadata_request_timeout": "4s",
- "min_metadata_refresh_interval": "3s",
- "name": "my_azure_event_hub_producer_connector",
- "node_status": [
- {
- "node": "emqx@localhost",
- "status": "connected"
}
], - "socket_opts": {
- "nodelay": true,
- "recbuf": "1024KB",
- "sndbuf": "1024KB",
- "tcp_keepalive": "none"
}, - "ssl": {
- "enable": true,
- "server_name_indication": "auto",
- "verify": "verify_none",
- "versions": [
- "tlsv1.3",
- "tlsv1.2"
]
}, - "status": "connected",
- "type": "azure_event_hub_producer"
}, - {
- "access_key_id": "******",
- "access_key_secret": "******",
- "actions": [
- "my_action"
], - "description": "My example tablestore connector",
- "enable": true,
- "instance_name": "myinstance",
- "name": "tablestore_connector",
- "node_status": [
- {
- "node": "emqx@localhost",
- "status": "connected"
}
], - "status": "connected",
- "storage_model_type": "timeseries",
- "type": "tablestore"
}, - {
- "actions": [
- "my_action"
], - "description": "My example opents connector",
- "enable": true,
- "name": "opents_connector",
- "node_status": [
- {
- "node": "emqx@localhost",
- "status": "connected"
}
], - "pool_size": 8,
- "status": "connected",
- "type": "opents"
}, - {
- "description": "My connector",
- "enable": true,
- "filepath": "/tmp/my_log",
- "max_file_number": 7,
- "max_file_size": "10MB",
- "node_status": [
- {
- "node": "emqx@localhost",
- "status": "connected"
}
], - "resource_opts": {
- "health_check_interval": "45s",
- "start_after_created": true,
- "start_timeout": "5s"
}, - "status": "connected"
}, - {
- "bootstrap_hosts": "kafka.emqx.net:9092",
- "name": "my_connector",
- "node_status": [
- {
- "node": "emqx@localhost",
- "status": "connected"
}
], - "resource_opts": {
- "health_check_interval": "30s",
- "start_after_created": true,
- "start_timeout": "5s"
}, - "status": "connected",
- "type": "kafka_consumer"
}
]
通过类型和名称创建一个新的连接器。
bridge_kafka.auth_gssapi_kerberos (object) or bridge_kafka.auth_username_password (object) or string or string Default: "none" 认证配置。 | |
bootstrap_hosts required | string 用逗号分隔的 |
connect_timeout | string Default: "5s" 建立 TCP 连接时的最大等待时长(若启用认证,这个等待时长也包含完成认证所需时间)。 |
description | string Default: "" 描述性文本。 |
enable | boolean Default: true 启用 (是) 或 停用 (否) 该连接器。 |
metadata_request_timeout | string Default: "5s" 刷新元数据时最大等待时长。 |
min_metadata_refresh_interval | string Default: "3s" 刷新 Kafka broker 和 Kafka 主题元数据段最短时间间隔。设置太小可能会增加 Kafka 压力。 |
name required | string 连接器的名称 |
object (bridge_kafka.connector_resource_opts) | |
object (bridge_kafka.socket_opts) | |
object (bridge_kafka.ssl_client_opts) | |
tags | Array of strings 连接器的标签 |
type required | string Value: "kafka_consumer" 连接器的类型。 |
{- "authentication": {
- "password": "******",
- "username": "root"
}, - "connect_timeout": "15s",
- "description": "My example elasticsearch connector",
- "enable": true,
- "enable_pipelining": 100,
- "name": "elasticsearch_connector",
- "pool_size": 8,
- "pool_type": "random",
- "server": "127.0.0.1:9200",
- "ssl": {
- "enable": false
}, - "type": "elasticsearch"
}
{- "actions": [
- "my_action"
], - "authentication": {
- "password": "******",
- "username": "root"
}, - "connect_timeout": "15s",
- "description": "My example elasticsearch connector",
- "enable": true,
- "enable_pipelining": 100,
- "name": "elasticsearch_connector",
- "node_status": [
- {
- "node": "emqx@localhost",
- "status": "connected"
}
], - "pool_size": 8,
- "pool_type": "random",
- "server": "127.0.0.1:9200",
- "ssl": {
- "enable": false
}, - "status": "connected",
- "type": "elasticsearch"
}
列出所有规则
enable | boolean 根据规则是否开启条件过滤 |
from | string 根据规则来源 Topic 过滤, 需要完全匹配 |
like_id | string 根据规则 id 过滤, 使用子串模糊匹配 |
like_from | string 根据规则来源 Topic 过滤, 使用子串模糊匹配 |
like_description | string 根据规则描述过滤, 使用子串模糊匹配 |
match_from | string 根据规则来源 Topic 过滤, 使用 MQTT Topic 匹配 |
action | Array of strings 筛选包含任意给定动作 ID 的规则。当与 source ID 筛选一起使用时,规则必须包含匹配某些条件的 source 和动作。 |
source | Array of strings 筛选包含任意给定 source ID 的规则。当与动作 ID 筛选一起使用时,规则必须包含匹配某些条件的 source 和动作。 |
page | integer >= 1 Default: 1 Example: page=1 要获取的结果所在页码。 |
limit | integer [ 1 .. 10000 ] Default: 100 Example: limit=50 每页返回的结果数量。 |
{- "data": [
- {
- "action_details": [
- {
- "name": "string",
- "status": "string",
- "type": "string"
}
], - "actions": [
- "webhook:my_webhook",
- {
- "args": {
- "payload": "${payload}",
- "topic": "t/1"
}, - "function": "republish"
}, - {
- "function": "console"
}
], - "created_at": "2021-12-01T15:00:43.153+08:00",
- "description": "Some description",
- "enable": true,
- "from": "t/#",
- "id": "293fb66f",
- "last_modified_at": "2021-12-24T15:00:44.153+08:00",
- "metadata": { },
- "name": "foo",
- "sql": "SELECT * FROM \"test/topic\" WHERE payload.x = 1"
}
], - "meta": {
- "count": 0,
- "hasnext": true,
- "limit": 50,
- "page": 1
}
}
通过指定 ID 创建规则
Array of rule_engine.user_provided_function (object) or rule_engine.builtin_action_console (object) or rule_engine.builtin_action_republish (object) or strings Default: [] 规则的动作列表。 | |
description | string Default: "" 规则的描述 |
enable | boolean Default: true 启用或禁用规则引擎 |
metadata | object 规则的元数据,不要手动修改 |
name | string Default: "" 规则名字 |
sql required | string 用于处理消息的 SQL 。 |
{- "actions": [
- "webhook:my_webhook",
- {
- "args": {
- "payload": "${payload}",
- "topic": "t/1"
}, - "function": "republish"
}, - {
- "function": "console"
}
], - "description": "Some description",
- "enable": true,
- "metadata": { },
- "name": "foo",
- "sql": "SELECT * FROM \"test/topic\" WHERE payload.x = 1"
}
{- "action_details": [
- {
- "name": "string",
- "status": "string",
- "type": "string"
}
], - "actions": [
- "webhook:my_webhook",
- {
- "args": {
- "payload": "${payload}",
- "topic": "t/1"
}, - "function": "republish"
}, - {
- "function": "console"
}
], - "created_at": "2021-12-01T15:00:43.153+08:00",
- "description": "Some description",
- "enable": true,
- "from": "t/#",
- "id": "293fb66f",
- "last_modified_at": "2021-12-24T15:00:44.153+08:00",
- "metadata": { },
- "name": "foo",
- "sql": "SELECT * FROM \"test/topic\" WHERE payload.x = 1"
}
通过 ID 查询规则
id required | string Example: my_rule_id |
{- "action_details": [
- {
- "name": "string",
- "status": "string",
- "type": "string"
}
], - "actions": [
- "webhook:my_webhook",
- {
- "args": {
- "payload": "${payload}",
- "topic": "t/1"
}, - "function": "republish"
}, - {
- "function": "console"
}
], - "created_at": "2021-12-01T15:00:43.153+08:00",
- "description": "Some description",
- "enable": true,
- "from": "t/#",
- "id": "293fb66f",
- "last_modified_at": "2021-12-24T15:00:44.153+08:00",
- "metadata": { },
- "name": "foo",
- "sql": "SELECT * FROM \"test/topic\" WHERE payload.x = 1"
}
通过 ID 更新集群里所有节点上的规则
id required | string Example: my_rule_id |
Array of rule_engine.user_provided_function (object) or rule_engine.builtin_action_console (object) or rule_engine.builtin_action_republish (object) or strings Default: [] 规则的动作列表。 | |
description | string Default: "" 规则的描述 |
enable | boolean Default: true 启用或禁用规则引擎 |
metadata | object 规则的元数据,不要手动修改 |
name | string Default: "" 规则名字 |
sql required | string 用于处理消息的 SQL 。 |
{- "actions": [
- "webhook:my_webhook",
- {
- "args": {
- "payload": "${payload}",
- "topic": "t/1"
}, - "function": "republish"
}, - {
- "function": "console"
}
], - "description": "Some description",
- "enable": true,
- "metadata": { },
- "name": "foo",
- "sql": "SELECT * FROM \"test/topic\" WHERE payload.x = 1"
}
{- "action_details": [
- {
- "name": "string",
- "status": "string",
- "type": "string"
}
], - "actions": [
- "webhook:my_webhook",
- {
- "args": {
- "payload": "${payload}",
- "topic": "t/1"
}, - "function": "republish"
}, - {
- "function": "console"
}
], - "created_at": "2021-12-01T15:00:43.153+08:00",
- "description": "Some description",
- "enable": true,
- "from": "t/#",
- "id": "293fb66f",
- "last_modified_at": "2021-12-24T15:00:44.153+08:00",
- "metadata": { },
- "name": "foo",
- "sql": "SELECT * FROM \"test/topic\" WHERE payload.x = 1"
}
依据指定的消息内容和运行环境执行相应的规则。
id required | string Example: my_rule_id |
rule_engine.ctx_unsub (object) or rule_engine.ctx_sub (object) or rule_engine.ctx_schema_validation_failed (object) or rule_engine.ctx_message_transformation_failed (object) or rule_engine.ctx_pub (object) or rule_engine.ctx_dropped (object) or rule_engine.ctx_delivered (object) or rule_engine.ctx_acked (object) or rule_engine.ctx_delivery_dropped (object) or rule_engine.ctx_disconnected (object) or rule_engine.ctx_connected (object) or rule_engine.ctx_connack (object) or rule_engine.ctx_check_authz_complete (object) or rule_engine.ctx_check_authn_complete (object) or rule_engine.ctx_alarm_deactivated (object) or rule_engine.ctx_alarm_activated (object) or rule_engine.ctx_bridge_mqtt (object) Default: {} 测试事件的上下文 | |
stop_action_after_template_rendering | boolean Default: true 如果操作在模板渲染后应该停止,请将此设置为 true(默认为 true)。 |
{- "context": { },
- "stop_action_after_template_rendering": true
}
{- "code": "BAD_REQUEST",
- "message": "string"
}
通过给定的 Id 获得规则的指标数据
id required | string Example: my_rule_id |
{- "id": "293fb66f",
- "metrics": {
- "actions.discarded": 0,
- "actions.failed": 0,
- "actions.failed.out_of_service": 0,
- "actions.failed.unknown": 0,
- "actions.success": 0,
- "actions.total": 0,
- "failed": 0,
- "failed.exception": 0,
- "failed.unknown": 0,
- "matched": 0,
- "matched.rate": 0,
- "matched.rate.last5m": 0,
- "matched.rate.max": 0,
- "passed": 0
}, - "node_metrics": [
- {
- "actions.discarded": 0,
- "actions.failed": 0,
- "actions.failed.out_of_service": 0,
- "actions.failed.unknown": 0,
- "actions.success": 0,
- "actions.total": 0,
- "failed": 0,
- "failed.exception": 0,
- "failed.unknown": 0,
- "matched": 0,
- "matched.rate": 0,
- "matched.rate.last5m": 0,
- "matched.rate.max": 0,
- "node": "emqx@127.0.0.1",
- "passed": 0
}
]
}
[- {
- "connector": "elasticsearch_connector",
- "description": "My example elasticsearch action",
- "enable": true,
- "name": "elasticsearch_action",
- "node_status": [
- {
- "node": "emqx@localhost",
- "status": "connected"
}
], - "parameters": {
- "action": "create",
- "doc": "${payload.doc}",
- "index": "${payload.index}",
- "overwrite": true
}, - "resource_opts": {
- "health_check_interval": "30s"
}, - "status": "connected",
- "type": "elasticsearch"
}, - {
- "connector": "oracle_connector",
- "description": "My example oracle action",
- "enable": true,
- "name": "oracle_action",
- "node_status": [
- {
- "node": "emqx@localhost",
- "status": "connected"
}
], - "parameters": {
- "sql": "insert into t_mqtt_msgs(msgid, topic, qos, payload) values (${id}, ${topic}, ${qos}, ${payload})"
}, - "resource_opts": {
- "health_check_interval": "30s"
}, - "status": "connected",
- "type": "oracle"
}, - {
- "connector": "sqlserver_connector",
- "description": "My example sqlserver action",
- "enable": true,
- "name": "sqlserver_action",
- "node_status": [
- {
- "node": "emqx@localhost",
- "status": "connected"
}
], - "parameters": {
- "sql": "insert into t_mqtt_msg(msgid, topic, qos, payload) values ( ${id}, ${topic}, ${qos}, ${payload} )"
}, - "resource_opts": {
- "health_check_interval": "30s"
}, - "status": "connected",
- "type": "sqlserver"
}, - {
- "connector": "hstreamdb_connector",
- "description": "My example hstreamdb action",
- "enable": true,
- "name": "hstreamdb_action",
- "node_status": [
- {
- "node": "emqx@localhost",
- "status": "connected"
}
], - "parameters": {
- "aggregation_pool_size": 8,
- "partition_key": "hej",
- "record_template": "${payload}",
- "stream": "mqtt_message",
- "writer_pool_size": 8
}, - "resource_opts": {
- "health_check_interval": "30s"
}, - "status": "connected",
- "type": "hstreamdb"
}, - {
- "connector": "tdengine_connector",
- "description": "My example tdengine action",
- "enable": true,
- "name": "tdengine_action",
- "node_status": [
- {
- "node": "emqx@localhost",
- "status": "connected"
}
], - "parameters": {
- "database": "mqtt",
- "sql": "insert into t_mqtt_msg(ts, msgid, mqtt_topic, qos, payload, arrived) values (${ts}, '${id}', '${topic}', ${qos}, '${payload}', ${timestamp})"
}, - "resource_opts": {
- "health_check_interval": "30s"
}, - "status": "connected",
- "type": "tdengine"
}, - {
- "connector": "rocketmq_connector",
- "description": "My example rocketmq action",
- "enable": true,
- "name": "rocketmq_action",
- "node_status": [
- {
- "node": "emqx@localhost",
- "status": "connected"
}
], - "parameters": {
- "refresh_interval": "3s",
- "send_buffer": "1024KB",
- "sync_timeout": "3s",
- "template": "",
- "topic": "TopicTest"
}, - "resource_opts": {
- "health_check_interval": "30s"
}, - "status": "connected",
- "type": "rocketmq"
}, - {
- "connector": "iotdb_connector",
- "description": "My example iotdb action",
- "enable": true,
- "name": "iotdb_action",
- "node_status": [
- {
- "node": "emqx@localhost",
- "status": "connected"
}
], - "parameters": {
- "data": [
- {
- "data_type": "BOOLEAN",
- "measurement": "status",
- "timestamp": "now",
- "value": "${st}"
}
], - "device_id": "my_device",
- "is_aligned": false
}, - "resource_opts": {
- "health_check_interval": "30s"
}, - "status": "connected",
- "type": "iotdb"
}, - {
- "connector": "dynamo_connector",
- "description": "My example dynamo action",
- "enable": true,
- "name": "dynamo_action",
- "node_status": [
- {
- "node": "emqx@localhost",
- "status": "connected"
}
], - "parameters": {
- "hash_key": "clientid",
- "table": "mqtt_msg",
- "template": ""
}, - "resource_opts": {
- "health_check_interval": "30s"
}, - "status": "connected",
- "type": "dynamo"
}, - {
- "connector": "my_connector",
- "enable": true,
- "name": "my_action",
- "node_status": [
- {
- "node": "emqx@localhost",
- "status": "connected"
}
], - "parameters": {
- "sql": "INSERT INTO client_events(clientid, event, created_at)VALUES (\n ${clientid},\n ${event},\n TO_TIMESTAMP((${timestamp} :: bigint))\n)"
}, - "resource_opts": {
- "batch_size": 1,
- "batch_time": "50ms",
- "inflight_window": 100,
- "max_buffer_bytes": "256MB",
- "request_ttl": "45s",
- "worker_pool_size": 16
}, - "status": "connected",
- "type": "timescale"
}, - {
- "connector": "my_connector",
- "description": "my action",
- "enable": true,
- "node_status": [
- {
- "node": "emqx@localhost",
- "status": "connected"
}
], - "parameters": {
- "sql": "insert into mqtt (key, value) values (${.id}, ${.payload})"
}, - "resource_opts": {
- "health_check_interval": "30s",
- "inflight_window": 100,
- "query_mode": "sync",
- "request_ttl": "45s",
- "worker_pool_size": 16
}, - "status": "connected"
}, - {
- "connector": "mqtt_connector",
- "description": "My example mqtt action",
- "enable": true,
- "name": "mqtt_action",
- "node_status": [
- {
- "node": "emqx@localhost",
- "status": "connected"
}
], - "parameters": {
- "payload": "${.payload}",
- "qos": 2,
- "retain": false,
- "topic": "remote/topic"
}, - "resource_opts": {
- "health_check_interval": "30s"
}, - "status": "connected",
- "type": "mqtt"
}, - {
- "connector": "greptimedb_connector",
- "description": "My example greptimedb action",
- "enable": true,
- "name": "greptimedb_action",
- "node_status": [
- {
- "node": "emqx@localhost",
- "status": "connected"
}
], - "parameters": {
- "precision": "ms",
- "write_syntax": "${topic},clientid=${clientid} payload=${payload},${clientid}_int_value=${payload.int_key}i,uint_value=${payload.uint_key}u,bool=${payload.bool}"
}, - "resource_opts": {
- "health_check_interval": "30s"
}, - "status": "connected",
- "type": "greptimedb"
}, - {
- "connector": "my_s3_connector",
- "description": "My upload action",
- "enable": true,
- "node_status": [
- {
- "node": "emqx@localhost",
- "status": "connected"
}
], - "parameters": {
- "acl": "public_read",
- "bucket": "${clientid}",
- "content": "${payload}",
- "key": "${topic}",
- "mode": "direct"
}, - "resource_opts": {
- "inflight_window": 10,
- "query_mode": "sync"
}, - "status": "connected"
}, - {
- "connector": "my_connector",
- "description": "my action",
- "enable": true,
- "node_status": [
- {
- "node": "emqx@localhost",
- "status": "connected"
}
], - "parameters": {
- "blob": "${.payload.blob}",
- "container": "${.payload.container}",
- "content": "${.payload}",
- "mode": "direct"
}, - "resource_opts": {
- "batch_size": 1,
- "batch_time": "0ms",
- "health_check_interval": "30s",
- "inflight_window": 100,
- "query_mode": "sync",
- "request_ttl": "45s",
- "worker_pool_size": 16
}, - "status": "connected"
}, - {
- "connector": "my_connector",
- "description": "my action",
- "enable": true,
- "node_status": [
- {
- "node": "emqx@localhost",
- "status": "connected"
}
], - "parameters": {
- "aggregation": {
- "max_records": 100000,
- "time_interval": "120s"
}, - "namespace": "my.ns",
- "table": "my_table"
}, - "resource_opts": {
- "batch_size": 10000,
- "batch_time": "60s",
- "health_check_interval": "30s",
- "inflight_window": 100,
- "query_mode": "sync",
- "request_ttl": "45s",
- "worker_pool_size": 16
}, - "status": "connected"
}, - {
- "connector": "clickhouse_connector",
- "description": "My example clickhouse action",
- "enable": true,
- "name": "clickhouse_action",
- "node_status": [
- {
- "node": "emqx@localhost",
- "status": "connected"
}
], - "parameters": {
- "batch_value_separator": ", ",
- "sql": "INSERT INTO messages(data, arrived) VALUES ('${payload}', ${timestamp})"
}, - "resource_opts": {
- "health_check_interval": "30s"
}, - "status": "connected",
- "type": "clickhouse"
}, - {
- "connector": "my_connector",
- "description": "my action",
- "enable": true,
- "node_status": [
- {
- "node": "emqx@localhost",
- "status": "connected"
}
], - "parameters": {
- "aggregation": {
- "container": {
- "column_order": [
- "a",
- "b"
], - "type": "csv"
}, - "max_records": 10000,
- "time_interval": "4s"
}, - "blob": "${action}/${node}/${datetime.rfc3339}/${sequence}",
- "container": "mycontainer",
- "mode": "aggregated"
}, - "resource_opts": {
- "batch_size": 100,
- "batch_time": "10ms",
- "health_check_interval": "30s",
- "inflight_window": 100,
- "query_mode": "sync",
- "request_ttl": "45s",
- "worker_pool_size": 16
}, - "status": "connected"
}, - {
- "connector": "influxdb_connector",
- "description": "My example influxdb action",
- "enable": true,
- "name": "influxdb_action",
- "node_status": [
- {
- "node": "emqx@localhost",
- "status": "connected"
}
], - "parameters": {
- "precision": "ms",
- "write_syntax": "${topic},clientid=${clientid} payload=${payload},${clientid}_int_value=${payload.int_key}i,bool=${payload.bool}"
}, - "resource_opts": {
- "health_check_interval": "30s"
}, - "status": "connected",
- "type": "influxdb"
}, - {
- "connector": "my_connector_name",
- "description": "My action",
- "enable": true,
- "node_status": [
- {
- "node": "emqx@localhost",
- "status": "connected"
}
], - "parameters": {
- "command_template": [
- "LPUSH",
- "MSGS",
- "${payload}"
]
}, - "resource_opts": {
- "batch_size": 1
}, - "status": "connected"
}, - {
- "connector": "my_s3_connector",
- "description": "My aggregated upload action",
- "enable": true,
- "node_status": [
- {
- "node": "emqx@localhost",
- "status": "connected"
}
], - "parameters": {
- "acl": "public_read",
- "aggregation": {
- "max_records": 100000,
- "time_interval": "15m"
}, - "bucket": "mqtt-aggregated",
- "container": {
- "column_order": [
- "clientid",
- "topic",
- "publish_received_at"
], - "type": "csv"
}, - "key": "${action}/${node}/${datetime.rfc3339utc}_N${sequence}.csv",
- "mode": "aggregated"
}, - "resource_opts": {
- "health_check_interval": "10s",
- "inflight_window": 100,
- "query_mode": "async"
}, - "status": "connected"
}, - {
- "connector": "rabbitmq_connector",
- "description": "My example rabbitmq action",
- "enable": true,
- "name": "rabbitmq_action",
- "node_status": [
- {
- "node": "emqx@localhost",
- "status": "connected"
}
], - "parameters": {
- "delivery_mode": "non_persistent",
- "exchange": "test_exchange",
- "payload_template": "${.payload}",
- "publish_confirmation_timeout": "30s",
- "routing_key": "/",
- "wait_for_publish_confirmations": true
}, - "resource_opts": {
- "health_check_interval": "30s"
}, - "status": "connected",
- "type": "rabbitmq"
}, - {
- "connector": "cassandra_connector",
- "description": "My example cassandra action",
- "enable": true,
- "name": "cassandra_action",
- "node_status": [
- {
- "node": "emqx@localhost",
- "status": "connected"
}
], - "parameters": {
- "cql": "insert into mqtt_msg(msgid, topic, qos, payload, arrived) values (${id}, ${topic}, ${qos}, ${payload}, ${timestamp})"
}, - "resource_opts": {
- "health_check_interval": "30s"
}, - "status": "connected",
- "type": "cassandra"
}, - {
- "connector": "syskeeper_forwarder",
- "enable": true,
- "name": "syskeeper_forwarder",
- "node_status": [
- {
- "node": "emqx@localhost",
- "status": "connected"
}
], - "parameters": {
- "target_topic": "${topic}",
- "template": "${payload}"
}, - "resource_opts": {
- "worker_pool_size": 16
}, - "status": "connected",
- "type": "syskeeper_forwarder"
}, - {
- "connector": "my_http_connector",
- "enable": true,
- "name": "my_http_action",
- "node_status": [
- {
- "node": "emqx@localhost",
- "status": "connected"
}
], - "parameters": {
- "body": "${.}",
- "headers": { },
- "method": "post",
- "path": "/room/${room_no}"
}, - "resource_opts": {
- "health_check_interval": "15s",
- "query_mode": "async",
- "worker_pool_size": 16
}, - "status": "connected",
- "type": "http"
}, - {
- "connector": "my_connector",
- "description": "my action",
- "enable": true,
- "node_status": [
- {
- "node": "emqx@localhost",
- "status": "connected"
}
], - "parameters": {
- "aggregation": {
- "container": {
- "type": "csv"
}, - "max_records": 1000,
- "time_interval": "60s"
}, - "connect_timeout": "15s",
- "database": "testdatabase",
- "max_retries": 3,
- "mode": "aggregated",
- "pipe": "testpipe",
- "pipe_user": "pipeuser",
- "pipelining": 100,
- "pool_size": 16,
- "private_key": "file:///path/to/secret.pem",
- "schema": "public",
- "stage": "teststage"
}, - "resource_opts": {
- "batch_size": 10000,
- "batch_time": "60s",
- "health_check_interval": "30s",
- "inflight_window": 100,
- "query_mode": "sync",
- "request_ttl": "45s",
- "worker_pool_size": 16
}, - "status": "connected"
}, - {
- "connector": "my_connector_name",
- "description": "My action",
- "enable": true,
- "local_topic": "local/topic",
- "node_status": [
- {
- "node": "emqx@localhost",
- "status": "connected"
}
], - "parameters": {
- "attributes_template": [
- {
- "key": "${payload.attrs.k}",
- "value": "${payload.attrs.v}"
}
], - "ordering_key_template": "${payload.ok}",
- "payload_template": "${payload}",
- "pubsub_topic": "mytopic"
}, - "resource_opts": {
- "batch_size": 5
}, - "status": "connected"
}, - {
- "connector": "mongodb_connector",
- "description": "My example mongodb action",
- "enable": true,
- "name": "mongodb_action",
- "node_status": [
- {
- "node": "emqx@localhost",
- "status": "connected"
}
], - "parameters": {
- "collection": "mycol"
}, - "resource_opts": {
- "health_check_interval": "30s"
}, - "status": "connected",
- "type": "mongodb"
}, - {
- "connector": "datalayers_connector",
- "description": "My example datalayers action",
- "enable": true,
- "name": "datalayers_action",
- "node_status": [
- {
- "node": "emqx@localhost",
- "status": "connected"
}
], - "parameters": {
- "precision": "ms",
- "write_syntax": "${topic},clientid=${clientid} payload=${payload},${clientid}_int_value=${payload.int_key}i,bool=${payload.bool}"
}, - "resource_opts": {
- "health_check_interval": "30s"
}, - "status": "connected",
- "type": "datalayers"
}, - {
- "connector": "pulsar_connector",
- "description": "My example pulsar action",
- "enable": true,
- "name": "pulsar_action",
- "node_status": [
- {
- "node": "emqx@localhost",
- "status": "connected"
}
], - "parameters": {
- "message": {
- "key": "${.clientid}",
- "value": "${.}"
}, - "pulsar_topic": "test_topic",
- "sync_timeout": "5s"
}, - "resource_opts": {
- "health_check_interval": "30s"
}, - "status": "connected",
- "type": "pulsar"
}, - {
- "connector": "kinesis_connector",
- "description": "My example kinesis action",
- "enable": true,
- "name": "kinesis_action",
- "node_status": [
- {
- "node": "emqx@localhost",
- "status": "connected"
}
], - "parameters": {
- "partition_key": "any_key",
- "payload_template": "${.}",
- "stream_name": "my_stream"
}, - "resource_opts": {
- "health_check_interval": "30s"
}, - "status": "connected",
- "type": "kinesis"
}, - {
- "connector": "my_connector",
- "enable": true,
- "name": "my_action",
- "node_status": [
- {
- "node": "emqx@localhost",
- "status": "connected"
}
], - "parameters": {
- "sql": "INSERT INTO client_events(clientid, event, created_at)VALUES (\n ${clientid},\n ${event},\n TO_TIMESTAMP((${timestamp} :: bigint))\n)"
}, - "resource_opts": {
- "batch_size": 1,
- "batch_time": "50ms",
- "inflight_window": 100,
- "max_buffer_bytes": "256MB",
- "request_ttl": "45s",
- "worker_pool_size": 16
}, - "status": "connected",
- "type": "pgsql"
}, - {
- "connector": "my_kafka_producer_connector",
- "enable": true,
- "local_topic": "mqtt/local/topic",
- "name": "my_kafka_producer_action",
- "node_status": [
- {
- "node": "emqx@localhost",
- "status": "connected"
}
], - "parameters": {
- "buffer": {
- "memory_overload_protection": true,
- "mode": "hybrid",
- "per_partition_limit": "2GB",
- "segment_bytes": "10MB"
}, - "compression": "no_compression",
- "kafka_ext_headers": [
- {
- "kafka_ext_header_key": "clientid",
- "kafka_ext_header_value": "${clientid}"
}, - {
- "kafka_ext_header_key": "topic",
- "kafka_ext_header_value": "${topic}"
}
], - "kafka_header_value_encode_mode": "none",
- "kafka_headers": "${pub_props}",
- "max_batch_bytes": "896KB",
- "max_inflight": 10,
- "max_linger_bytes": "10MB",
- "max_linger_time": "5ms",
- "message": {
- "key": "${.clientid}",
- "timestamp": "${.timestamp}",
- "value": "${.}"
}, - "partition_count_refresh_interval": "60s",
- "partition_strategy": "random",
- "partitions_limit": "all_partitions",
- "required_acks": "all_isr",
- "topic": "kafka-topic"
}, - "resource_opts": {
- "health_check_interval": "32s"
}, - "status": "connected",
- "type": "kafka_producer"
}, - {
- "connector": "mysql_connector",
- "description": "My example mysql action",
- "enable": true,
- "name": "mysql_action",
- "node_status": [
- {
- "node": "emqx@localhost",
- "status": "connected"
}
], - "parameters": {
- "sql": "insert into t_mqtt_msg(msgid, topic, qos, payload, arrived) values (${id}, ${topic}, ${qos}, ${payload}, FROM_UNIXTIME(${timestamp}/1000))"
}, - "resource_opts": {
- "health_check_interval": "30s"
}, - "status": "connected",
- "type": "mysql"
}, - {
- "connector": "my_confluent_producer_connector",
- "enable": true,
- "local_topic": "mqtt/local/topic",
- "name": "my_confluent_producer_action",
- "node_status": [
- {
- "node": "emqx@localhost",
- "status": "connected"
}
], - "parameters": {
- "buffer": {
- "memory_overload_protection": true,
- "mode": "hybrid",
- "per_partition_limit": "2GB",
- "segment_bytes": "100MB"
}, - "kafka_ext_headers": [
- {
- "kafka_ext_header_key": "clientid",
- "kafka_ext_header_value": "${clientid}"
}, - {
- "kafka_ext_header_key": "topic",
- "kafka_ext_header_value": "${topic}"
}
], - "kafka_header_value_encode_mode": "none",
- "kafka_headers": "${.pub_props}",
- "max_batch_bytes": "896KB",
- "max_inflight": 10,
- "max_linger_bytes": "10MB",
- "max_linger_time": "5ms",
- "message": {
- "key": "${.clientid}",
- "value": "${.}"
}, - "partition_count_refresh_interval": "60s",
- "partition_strategy": "random",
- "required_acks": "all_isr",
- "topic": "topic"
}, - "status": "connected",
- "type": "confluent_producer"
}, - {
- "connector": "my_connector",
- "description": "my action",
- "enable": true,
- "node_status": [
- {
- "node": "emqx@localhost",
- "status": "connected"
}
], - "parameters": {
- "sql": "insert into t_mqtt_msg(msgid, topic, qos, payload, arrived) values (${id}, ${topic}, ${qos}, ${payload}, FROM_UNIXTIME(${timestamp}/1000))"
}, - "resource_opts": {
- "batch_size": 1,
- "batch_time": "0s",
- "health_check_interval": "30s",
- "inflight_window": 100,
- "query_mode": "sync",
- "request_ttl": "45s",
- "worker_pool_size": 16
}, - "status": "connected"
}, - {
- "connector": "my_connector",
- "enable": true,
- "name": "my_action",
- "node_status": [
- {
- "node": "emqx@localhost",
- "status": "connected"
}
], - "parameters": {
- "sql": "INSERT INTO client_events(clientid, event, created_at)VALUES (\n ${clientid},\n ${event},\n TO_TIMESTAMP((${timestamp} :: bigint))\n)"
}, - "resource_opts": {
- "batch_size": 1,
- "batch_time": "50ms",
- "inflight_window": 100,
- "max_buffer_bytes": "256MB",
- "request_ttl": "45s",
- "worker_pool_size": 16
}, - "status": "connected",
- "type": "matrix"
}, - {
- "connector": "my_azure_event_hub_producer_connector",
- "enable": true,
- "local_topic": "mqtt/local/topic",
- "name": "my_azure_event_hub_producer_action",
- "node_status": [
- {
- "node": "emqx@localhost",
- "status": "connected"
}
], - "parameters": {
- "buffer": {
- "memory_overload_protection": true,
- "mode": "hybrid",
- "per_partition_limit": "2GB",
- "segment_bytes": "100MB"
}, - "kafka_ext_headers": [
- {
- "kafka_ext_header_key": "clientid",
- "kafka_ext_header_value": "${clientid}"
}, - {
- "kafka_ext_header_key": "topic",
- "kafka_ext_header_value": "${topic}"
}
], - "kafka_header_value_encode_mode": "none",
- "kafka_headers": "${.pub_props}",
- "max_batch_bytes": "896KB",
- "max_inflight": 10,
- "max_linger_bytes": "10MB",
- "max_linger_time": "5ms",
- "message": {
- "key": "${.clientid}",
- "value": "${.}"
}, - "partition_count_refresh_interval": "60s",
- "partition_strategy": "random",
- "required_acks": "all_isr",
- "topic": "topic"
}, - "status": "connected",
- "type": "azure_event_hub_producer"
}, - {
- "connector": "tablestore_connector",
- "description": "My example tablestore action",
- "enable": true,
- "name": "tablestore_action",
- "node_status": [
- {
- "node": "emqx@localhost",
- "status": "connected"
}
], - "parameters": {
- "data_source": "${data_source}",
- "fields": [
- {
- "column": "${column}",
- "isint": true,
- "value": "${value}"
}
], - "measurement": "${measurement}",
- "meta_update_model": "MUM_IGNORE",
- "storage_model_type": "timeseries",
- "table_name": "table_name",
- "tags": {
- "tag1": "${tag1}",
- "tag2": "${tag2}"
}
}, - "resource_opts": {
- "health_check_interval": "30s"
}, - "status": "connected",
- "type": "tablestore"
}, - {
- "connector": "opents_connector",
- "description": "My example opents action",
- "enable": true,
- "name": "opents_action",
- "node_status": [
- {
- "node": "emqx@localhost",
- "status": "connected"
}
], - "parameters": {
- "data": [
- {
- "metric": "${metric}",
- "tags": "${tags}",
- "value": "${value}"
}
]
}, - "resource_opts": {
- "health_check_interval": "30s"
}, - "status": "connected",
- "type": "opents"
}, - {
- "connector": "my_connector",
- "description": "my action",
- "enable": true,
- "node_status": [
- {
- "node": "emqx@localhost",
- "status": "connected"
}
], - "parameters": {
- "template": "${.}",
- "write_mode": "sync"
}, - "resource_opts": {
- "batch_size": 10000,
- "batch_time": "60s",
- "health_check_interval": "30s",
- "inflight_window": 100,
- "query_mode": "sync",
- "request_ttl": "45s",
- "worker_pool_size": 16
}, - "status": "connected"
}
]
通过类型和名称创建一个新的数据桥接。
connector required | string 由动作指定的连接器名称,用于选择外部资源。 |
description | string Default: "" 描述性文本。 |
enable | boolean Default: true 启用(是)或停用(否)此动作。 |
Array of actions_and_sources.fallback_action_republish (object) or actions_and_sources.fallback_action_reference (object) Default: [] 如果此操作的查询失败,将触发的回退操作列表。 | |
local_topic | string MQTT 主题或主题过滤器作为数据源(动作输入)。 如果规则动作用作数据源,则应将此配置留空,否则消息将在远程系统中重复。 |
name required | string |
required | object (action_disk_log.action_parameters) |
object (actions_and_sources.action_resource_opts) | |
tags | Array of strings 连接器的标签 |
type required | string Value: "disk_log" |
{- "connector": "elasticsearch_connector",
- "description": "My example elasticsearch action",
- "enable": true,
- "name": "elasticsearch_action",
- "parameters": {
- "action": "create",
- "doc": "${payload.doc}",
- "index": "${payload.index}",
- "overwrite": true
}, - "resource_opts": {
- "health_check_interval": "30s"
}, - "type": "elasticsearch"
}
{- "connector": "elasticsearch_connector",
- "description": "My example elasticsearch action",
- "enable": true,
- "name": "elasticsearch_action",
- "node_status": [
- {
- "node": "emqx@localhost",
- "status": "connected"
}
], - "parameters": {
- "action": "create",
- "doc": "${payload.doc}",
- "index": "${payload.index}",
- "overwrite": true
}, - "resource_opts": {
- "health_check_interval": "30s"
}, - "status": "connected",
- "type": "elasticsearch"
}
[- {
- "created_at": 1736512728666,
- "enable": true,
- "last_modified_at": 1736512728666,
- "name": "myAction",
- "node_status": [
- {
- "node": "emqx@127.0.0.1",
- "status": "connected",
- "status_reason": ""
}
], - "rules": [
- "rule1",
- "rule2"
], - "status": "connected",
- "status_reason": "",
- "type": "action_type"
}
]
[- "http",
- "cassandra",
- "rabbitmq",
- "rocketmq",
- "syskeeper_forwarder",
- "mongodb",
- "iotdb",
- "greptimedb",
- "hstreamdb",
- "confluent_producer",
- "azure_event_hub_producer",
- "gcp_pubsub_producer",
- "sqlserver",
- "pulsar",
- "kafka_producer",
- "influxdb",
- "redis",
- "datalayers",
- "opents",
- "s3tables",
- "doris",
- "kinesis",
- "s3",
- "mqtt",
- "tdengine",
- "timescale",
- "snowflake",
- "couchbase",
- "oracle",
- "clickhouse",
- "azure_blob_storage",
- "tablestore",
- "disk_log",
- "elasticsearch",
- "matrix",
- "pgsql",
- "mysql",
- "dynamo"
]
启用或禁用集群内所有节点上的数据桥接。
id required | string Example: http:my_http_action 数据桥接 ID,格式必须为 {type}:{name}。 |
enable required | boolean Example: true 是否启用该数据桥接。 |
{- "code": "NOT_FOUND",
- "message": "string"
}
启用集群中所有节点上的数据桥接。
id required | string Example: http:my_http_action 数据桥接 ID,格式必须为 {type}:{name}。 |
operation required | string Value: "start" Example: start 集群可用操作:'启动'。 |
{- "code": "BAD_REQUEST",
- "message": "string"
}
通过 id 删除数据桥接
id required | string Example: http:my_http_action 数据桥接 ID,格式必须为 {type}:{name}。 |
also_delete_dep_actions | boolean Default: false 是否级联删除依赖的动作。 |
{- "code": "BAD_REQUEST",
- "message": "string",
- "rules": [
- "string"
]
}
通过 id 获取一个数据桥接
id required | string Example: http:my_http_action 数据桥接 ID,格式必须为 {type}:{name}。 |
{- "connector": "elasticsearch_connector",
- "description": "My example elasticsearch action",
- "enable": true,
- "name": "elasticsearch_action",
- "node_status": [
- {
- "node": "emqx@localhost",
- "status": "connected"
}
], - "parameters": {
- "action": "create",
- "doc": "${payload.doc}",
- "index": "${payload.index}",
- "overwrite": true
}, - "resource_opts": {
- "health_check_interval": "30s"
}, - "status": "connected",
- "type": "elasticsearch"
}
通过 id 更新数据桥接
id required | string Example: http:my_http_action 数据桥接 ID,格式必须为 {type}:{name}。 |
connector required | string 由动作指定的连接器名称,用于选择外部资源。 |
description | string Default: "" 描述性文本。 |
enable | boolean Default: true 启用(是)或停用(否)此动作。 |
Array of actions_and_sources.fallback_action_republish (object) or actions_and_sources.fallback_action_reference (object) Default: [] 如果此操作的查询失败,将触发的回退操作列表。 | |
local_topic | string MQTT 主题或主题过滤器作为数据源(动作输入)。 如果规则动作用作数据源,则应将此配置留空,否则消息将在远程系统中重复。 |
required | object (action_disk_log.action_parameters) |
object (actions_and_sources.action_resource_opts) | |
tags | Array of strings 连接器的标签 |
{- "connector": "elasticsearch_connector",
- "description": "My example elasticsearch action",
- "enable": true,
- "parameters": {
- "action": "create",
- "doc": "${payload.doc}",
- "index": "${payload.index}",
- "overwrite": true
}, - "resource_opts": {
- "health_check_interval": "30s"
}
}
{- "connector": "elasticsearch_connector",
- "description": "My example elasticsearch action",
- "enable": true,
- "name": "elasticsearch_action",
- "node_status": [
- {
- "node": "emqx@localhost",
- "status": "connected"
}
], - "parameters": {
- "action": "create",
- "doc": "${payload.doc}",
- "index": "${payload.index}",
- "overwrite": true
}, - "resource_opts": {
- "health_check_interval": "30s"
}, - "status": "connected",
- "type": "elasticsearch"
}
通过 id 来获取数据桥接的指标信息。
id required | string Example: http:my_http_action 数据桥接 ID,格式必须为 {type}:{name}。 |
{- "metrics": {
- "dropped": 0,
- "dropped.other": 0,
- "dropped.queue_full": 0,
- "dropped.resource_not_found": 0,
- "dropped.resource_stopped": 0,
- "failed": 0,
- "inflight": 0,
- "matched": 0,
- "queuing": 0,
- "rate": 0,
- "rate_last5m": 0,
- "rate_max": 0,
- "received": 0,
- "retried": 0,
- "success": 0
}, - "node_metrics": [
- {
- "metrics": {
- "dropped": 0,
- "dropped.other": 0,
- "dropped.queue_full": 0,
- "dropped.resource_not_found": 0,
- "dropped.resource_stopped": 0,
- "failed": 0,
- "inflight": 0,
- "matched": 0,
- "queuing": 0,
- "rate": 0,
- "rate_last5m": 0,
- "rate_max": 0,
- "received": 0,
- "retried": 0,
- "success": 0
}, - "node": "emqx@127.0.0.1"
}
]
}
测试创建一个新的数据桥接。
connector required | string 由动作指定的连接器名称,用于选择外部资源。 |
description | string Default: "" 描述性文本。 |
enable | boolean Default: true 启用(是)或停用(否)此动作。 |
Array of actions_and_sources.fallback_action_republish (object) or actions_and_sources.fallback_action_reference (object) Default: [] 如果此操作的查询失败,将触发的回退操作列表。 | |
local_topic | string MQTT 主题或主题过滤器作为数据源(动作输入)。 如果规则动作用作数据源,则应将此配置留空,否则消息将在远程系统中重复。 |
name required | string |
required | object (action_disk_log.action_parameters) |
object (actions_and_sources.action_resource_opts) | |
tags | Array of strings 连接器的标签 |
type required | string Value: "disk_log" |
{- "connector": "elasticsearch_connector",
- "description": "My example elasticsearch action",
- "enable": true,
- "name": "elasticsearch_action",
- "parameters": {
- "action": "create",
- "doc": "${payload.doc}",
- "index": "${payload.index}",
- "overwrite": true
}, - "resource_opts": {
- "health_check_interval": "30s"
}, - "type": "elasticsearch"
}
{- "code": "TEST_FAILED",
- "message": "string"
}
对输入数据进行转换测试
required | object (message_transformation_http_api.dryrun_input_message) |
required | object (message_transformation.transformation) |
{- "message": {
- "client_attrs": { },
- "payload": "{}",
- "qos": 2,
- "retain": true,
- "topic": "t/u/v",
- "user_property": { }
}, - "transformation": {
- "description": "my transformation",
- "enable": true,
- "failure_action": "drop",
- "log_failure": {
- "level": "info"
}, - "name": "my_transformation",
- "operations": [
- {
- "key": "topic",
- "value": "concat([topic, '/', payload.t])"
}
], - "payload_decoder": {
- "type": "json"
}, - "payload_encoder": {
- "type": "json"
}, - "tags": [
- "transformation"
], - "topics": [
- "t/+"
]
}
}
{- "code": "BAD_REQUEST",
- "message": "string"
}
查找一个转换
name required | string Example: my_transformation 转换名称 |
{- "description": "my transformation",
- "enable": true,
- "failure_action": "drop",
- "log_failure": {
- "level": "info"
}, - "name": "my_transformation",
- "operations": [
- {
- "key": "topic",
- "value": "concat([topic, '/', payload.t])"
}
], - "payload_decoder": {
- "type": "json"
}, - "payload_encoder": {
- "type": "json"
}, - "tags": [
- "transformation"
], - "topics": [
- "t/+"
]
}
[- {
- "description": "my transformation",
- "enable": true,
- "failure_action": "drop",
- "log_failure": {
- "level": "info"
}, - "name": "my_transformation",
- "operations": [
- {
- "key": "topic",
- "value": "concat([topic, '/', payload.t])"
}
], - "payload_decoder": {
- "type": "json"
}, - "payload_encoder": {
- "type": "json"
}, - "tags": [
- "transformation"
], - "topics": [
- "t/+"
]
}, - {
- "description": "my transformation",
- "enable": true,
- "failure_action": "drop",
- "log_failure": {
- "level": "info"
}, - "name": "other_transformation",
- "operations": [
- {
- "key": "topic",
- "value": "concat([topic, '/', payload.t])"
}
], - "payload_decoder": {
- "type": "json"
}, - "payload_encoder": {
- "type": "json"
}, - "tags": [
- "transformation"
], - "topics": [
- "t/+"
]
}
]
向消息转换列表中添加新的转换
description | string Default: "" 描述性文本。 |
enable | boolean Default: true |
failure_action required | string Enum: "drop" "disconnect" "ignore" |
object (message_transformation.log_failure) | |
name required | string |
Array of objects (message_transformation.operation) Default: [] | |
string or string or string or string or string Default: {"type":"none"} | |
string or string or string or string or string Default: {"type":"none"} | |
tags | Array of strings 连接器的标签 |
required | Array of strings or string |
{- "description": "my transformation",
- "enable": true,
- "failure_action": "drop",
- "log_failure": {
- "level": "info"
}, - "name": "my_transformation",
- "operations": [
- {
- "key": "topic",
- "value": "concat([topic, '/', payload.t])"
}
], - "payload_decoder": {
- "type": "json"
}, - "payload_encoder": {
- "type": "json"
}, - "tags": [
- "transformation"
], - "topics": [
- "t/+"
]
}
{- "description": "my transformation",
- "enable": true,
- "failure_action": "drop",
- "log_failure": {
- "level": "info"
}, - "name": "my_transformation",
- "operations": [
- {
- "key": "topic",
- "value": "concat([topic, '/', payload.t])"
}
], - "payload_decoder": {
- "type": "json"
}, - "payload_encoder": {
- "type": "json"
}, - "tags": [
- "transformation"
], - "topics": [
- "t/+"
]
}
更新一个转换
description | string Default: "" 描述性文本。 |
enable | boolean Default: true |
failure_action required | string Enum: "drop" "disconnect" "ignore" |
object (message_transformation.log_failure) | |
name required | string |
Array of objects (message_transformation.operation) Default: [] | |
string or string or string or string or string Default: {"type":"none"} | |
string or string or string or string or string Default: {"type":"none"} | |
tags | Array of strings 连接器的标签 |
required | Array of strings or string |
{- "description": "my transformation",
- "enable": true,
- "failure_action": "drop",
- "log_failure": {
- "level": "info"
}, - "name": "my_transformation",
- "operations": [
- {
- "key": "topic",
- "value": "concat([topic, '/', payload.t])"
}
], - "payload_decoder": {
- "type": "json"
}, - "payload_encoder": {
- "type": "json"
}, - "tags": [
- "transformation"
], - "topics": [
- "t/+"
]
}
{- "description": "my transformation",
- "enable": true,
- "failure_action": "drop",
- "log_failure": {
- "level": "info"
}, - "name": "my_transformation",
- "operations": [
- {
- "key": "topic",
- "value": "concat([topic, '/', payload.t])"
}
], - "payload_decoder": {
- "type": "json"
}, - "payload_encoder": {
- "type": "json"
}, - "tags": [
- "transformation"
], - "topics": [
- "t/+"
]
}
获取一个特定转换的指标
name required | string Example: my_transformation 转换名称 |
{- "metrics": {
- "failed": 1,
- "matched": 2,
- "rate": 1.23,
- "rate_last5m": 0.88,
- "rate_max": 1.87,
- "succeeded": 1
}, - "node_metrics": [
- {
- "metrics": {
- "failed": 1,
- "matched": 2,
- "rate": 1.23,
- "rate_last5m": 0.88,
- "rate_max": 1.87,
- "succeeded": 1
}, - "node": "emqx@127.0.0.1"
}
]
}
重新排序所有的消息转换
order required | Array of strings |
{- "order": [
- "bar",
- "foo",
- "baz"
]
}
{- "code": "BAD_REQUEST",
- "duplicated": [
- "string"
], - "message": "string",
- "not_found": [
- "string"
], - "not_reordered": [
- "string"
]
}
[- {
- "checks": [
- {
- "sql": "select payload.temp as t where t > 10",
- "type": "sql"
}
], - "description": "my validation",
- "enable": true,
- "failure_action": "drop",
- "log_failure": {
- "level": "info"
}, - "name": "my_validation",
- "strategy": "all_pass",
- "tags": [
- "validation"
], - "topics": [
- "t/+"
]
}, - {
- "checks": [
- {
- "schema": "my_avro_schema",
- "type": "avro"
}
], - "description": "my validation",
- "enable": true,
- "failure_action": "drop",
- "log_failure": {
- "level": "info"
}, - "name": "other_validation",
- "strategy": "all_pass",
- "tags": [
- "validation"
], - "topics": [
- "t/+"
]
}
]
在验证规则列表中添加新的验证规则。
required | Array of schema_validation.check_external_http (object) or schema_validation.check_protobuf (object) or schema_validation.check_avro (object) or schema_validation.check_json (object) or schema_validation.check_sql (object) 在验证过程中将执行的检查。它们将按照定义的顺序进行评估。 |
description | string Default: "" 描述性文本。 |
enable | boolean Default: true |
failure_action required | string Enum: "drop" "disconnect" "ignore" 如果验证失败,将如何处理。 |
object (schema_validation.log_failure) | |
name required | string 名称 |
strategy required | string Enum: "any_pass" "all_pass" 验证策略 |
tags | Array of strings 连接器的标签 |
required | Array of strings or string 此验证规则应验证的单个主题过滤器或主题过滤器列表。 |
{- "checks": [
- {
- "schema": "my_avro_schema",
- "type": "avro"
}
], - "description": "my validation",
- "enable": true,
- "failure_action": "drop",
- "log_failure": {
- "level": "info"
}, - "name": "my_validation",
- "strategy": "all_pass",
- "tags": [
- "validation"
], - "topics": [
- "t/+"
]
}
{- "checks": [
- {
- "schema": "my_avro_schema",
- "type": "avro"
}
], - "description": "my validation",
- "enable": true,
- "failure_action": "drop",
- "log_failure": {
- "level": "info"
}, - "name": "my_validation",
- "strategy": "all_pass",
- "tags": [
- "validation"
], - "topics": [
- "t/+"
]
}
更新一条验证规则。
required | Array of schema_validation.check_external_http (object) or schema_validation.check_protobuf (object) or schema_validation.check_avro (object) or schema_validation.check_json (object) or schema_validation.check_sql (object) 在验证过程中将执行的检查。它们将按照定义的顺序进行评估。 |
description | string Default: "" 描述性文本。 |
enable | boolean Default: true |
failure_action required | string Enum: "drop" "disconnect" "ignore" 如果验证失败,将如何处理。 |
object (schema_validation.log_failure) | |
name required | string 名称 |
strategy required | string Enum: "any_pass" "all_pass" 验证策略 |
tags | Array of strings 连接器的标签 |
required | Array of strings or string 此验证规则应验证的单个主题过滤器或主题过滤器列表。 |
{- "checks": [
- {
- "sql": "select payload.temp as t where t > 10",
- "type": "sql"
}
], - "description": "my validation",
- "enable": true,
- "failure_action": "drop",
- "log_failure": {
- "level": "info"
}, - "name": "my_validation",
- "strategy": "all_pass",
- "tags": [
- "validation"
], - "topics": [
- "t/+"
]
}
{- "checks": [
- {
- "sql": "select payload.temp as t where t > 10",
- "type": "sql"
}
], - "description": "my validation",
- "enable": true,
- "failure_action": "drop",
- "log_failure": {
- "level": "info"
}, - "name": "my_validation",
- "strategy": "all_pass",
- "tags": [
- "validation"
], - "topics": [
- "t/+"
]
}
获取某个特定验证规则的指标。
name required | string Example: my_validation 验证规则名称 |
{- "metrics": {
- "failed": 1,
- "matched": 2,
- "rate": 1.23,
- "rate_last5m": 0.88,
- "rate_max": 1.87,
- "succeeded": 1
}, - "node_metrics": [
- {
- "metrics": {
- "failed": 1,
- "matched": 2,
- "rate": 1.23,
- "rate_last5m": 0.88,
- "rate_max": 1.87,
- "succeeded": 1
}, - "node": "emqx@127.0.0.1"
}
]
}
重新排序所有验证规则
order required | Array of strings |
{- "order": [
- "bar",
- "foo",
- "baz"
]
}
{- "code": "BAD_REQUEST",
- "duplicated": [
- "string"
], - "message": "string",
- "not_found": [
- "string"
], - "not_reordered": [
- "string"
]
}
查找一条验证规则
name required | string Example: my_validation 验证规则名称 |
{- "checks": [
- {
- "schema": "my_avro_schema",
- "type": "avro"
}
], - "description": "my validation",
- "enable": true,
- "failure_action": "drop",
- "log_failure": {
- "level": "info"
}, - "name": "my_validation",
- "strategy": "all_pass",
- "tags": [
- "validation"
], - "topics": [
- "t/+"
]
}
获取集群的订阅列表。
page | integer >= 1 Default: 1 Example: page=1 要获取的结果所在页码。 |
limit | integer [ 1 .. 10000 ] Default: 100 Example: limit=50 每页返回的结果数量。 |
node | string Example: node=emqx@127.0.0.1 Node name |
clientid | string Client ID |
qos | integer [ 0 .. 2 ] Example: qos=0 QoS |
topic | string Topic, url encoding |
match_topic | string Match topic string, url encoding |
share_group | string Shared subscription group name |
durable | boolean Filter subscriptions by durability |
[- {
- "clientid": "emqx_clientid_xx128cdhfc",
- "durable": false,
- "nl": 0,
- "node": "emqx@127.0.0.1",
- "qos": 0,
- "rap": 0,
- "rh": 0,
- "topic": "testtopic/1"
}
]
通过名称获取一个 schema。
name required | string Example: my_schema Schema 的名称。 |
{- "description": "My Avro Schema",
- "name": "my_avro_schema",
- "source": "{\"type\":\"record\",\"name\":\"test\",\"fields\":[{\"type\":\"int\",\"name\":\"i\"},{\"type\":\"string\",\"name\":\"s\"}]}",
- "type": "avro"
}
更新一个现有的 schema。
name required | string Example: my_schema Schema 的名称。 |
description | string Default: "" 改 schema 的描述。 |
required | object (schema_registry.external_http_params) |
type required | string Value: "external_http" 对于外部 HTTP,必须设置为 |
{- "description": "My Avro Schema",
- "source": "{\"type\":\"record\",\"name\":\"test\",\"fields\":[{\"type\":\"int\",\"name\":\"i\"},{\"type\":\"string\",\"name\":\"s\"}]}",
- "type": "avro"
}
{- "description": "My Avro Schema",
- "name": "my_avro_schema",
- "source": "{\"type\":\"record\",\"name\":\"test\",\"fields\":[{\"type\":\"int\",\"name\":\"i\"},{\"type\":\"string\",\"name\":\"s\"}]}",
- "type": "avro"
}
[- {
- "description": "My Avro Schema",
- "name": "my_avro_schema",
- "source": "{\"type\":\"record\",\"name\":\"test\",\"fields\":[{\"type\":\"int\",\"name\":\"i\"},{\"type\":\"string\",\"name\":\"s\"}]}",
- "type": "avro"
}
]
注册一个新的 schema。
description | string Default: "" 改 schema 的描述。 |
name required | string Schema 的一个名称,将用作其标识符。 |
required | object (schema_registry.external_http_params) |
type required | string Value: "external_http" 对于外部 HTTP,必须设置为 |
{- "description": "My Avro Schema",
- "name": "my_avro_schema",
- "source": "{\"type\":\"record\",\"name\":\"test\",\"fields\":[{\"type\":\"int\",\"name\":\"i\"},{\"type\":\"string\",\"name\":\"s\"}]}",
- "type": "avro"
}
{- "description": "My Avro Schema",
- "name": "my_avro_schema",
- "source": "{\"type\":\"record\",\"name\":\"test\",\"fields\":[{\"type\":\"int\",\"name\":\"i\"},{\"type\":\"string\",\"name\":\"s\"}]}",
- "type": "avro"
}
为新 Schema 上传 Protobuf 包
bundle | string <binary> |
description | string |
name | string |
root_proto_file | string |
{- "description": "My Avro Schema",
- "name": "my_avro_schema",
- "source": "{\"type\":\"record\",\"name\":\"test\",\"fields\":[{\"type\":\"int\",\"name\":\"i\"},{\"type\":\"string\",\"name\":\"s\"}]}",
- "type": "avro"
}
为现有 Schema 上传 Protobuf 包
bundle | string <binary> |
description | string |
name | string |
root_proto_file | string |
{- "description": "My Avro Schema",
- "source": "{\"type\":\"record\",\"name\":\"test\",\"fields\":[{\"type\":\"int\",\"name\":\"i\"},{\"type\":\"string\",\"name\":\"s\"}]}",
- "type": "avro"
}
批量发布多条消息。
可能的 HTTP 状态码如下:
200: 所有的消息都被成功发送到至少一个订阅。
202: 至少有一个消息没有匹配到任何订阅。
400: 至少有一个消息编码错误,如非法主题,或 QoS 超出范围等。
503: 至少有一个小因为服务重启的原因导致转发失败。
请求的 Body 或者 Body 中包含的某个消息无法通过 API 规范的类型检查时,HTTP 响应的消息与发布单个消息的 API
/publish
是一样的。
如果所有的消息都是合法的,那么 HTTP 返回的内容是一个 JSON 数组,每个元素代表了该消息转发的状态。
clientid | string Deprecated |
payload required | string MQTT 消息体. |
payload_encoding | string Default: "plain" Enum: "plain" "base64" MQTT 消息体的编码方式,可以是 |
object (emqx_mgmt_api_publish.message_properties) | |
qos | integer [ 0 .. 2 ] Default: 0 QoS |
retain | boolean Default: false 保留消息,布尔型字段,用于表示该消息是否是保留消息。 |
topic required | string 主题 |
[- {
- "clientid": "string",
- "payload": "hello emqx api",
- "payload_encoding": "plain",
- "properties": {
- "content_type": "text/plain",
- "correlation_data": "string",
- "message_expiry_interval": 0,
- "payload_format_indicator": 0,
- "response_topic": "some_other_topic",
- "user_properties": {
- "foo": "bar"
}
}, - "qos": 0,
- "retain": false,
- "topic": "api/example/topic"
}
]
[- {
- "id": "string"
}
]
发布单条信息。
可能的 HTTP 状态码如下:
200: 消息被成功发送到至少一个订阅。
202: 没有匹配到任何订阅。
400: 消息编码错误,如非法主题,或 QoS 超出范围等。
503: 服务重启等过程中导致转发失败。
clientid | string Deprecated |
payload required | string MQTT 消息体. |
payload_encoding | string Default: "plain" Enum: "plain" "base64" MQTT 消息体的编码方式,可以是 |
object (emqx_mgmt_api_publish.message_properties) | |
qos | integer [ 0 .. 2 ] Default: 0 QoS |
retain | boolean Default: false 保留消息,布尔型字段,用于表示该消息是否是保留消息。 |
topic required | string 主题 |
{- "clientid": "string",
- "payload": "hello emqx api",
- "payload_encoding": "plain",
- "properties": {
- "content_type": "text/plain",
- "correlation_data": "string",
- "message_expiry_interval": 0,
- "payload_format_indicator": 0,
- "response_topic": "some_other_topic",
- "user_properties": {
- "foo": "bar"
}
}, - "qos": 0,
- "retain": false,
- "topic": "api/example/topic"
}
{- "id": "string"
}
更新内置数据库认证器中的指定用户数据。
user_id required | string 用户 ID,根据设置的账号类型不同,可以是 username 或 clientid |
is_superuser | boolean Default: false |
password required | string |
{- "password": "******"
}
{- "regular_user": {
- "summary": "Regular user",
- "value": {
- "user_id": "user1"
}
}, - "super_user": {
- "summary": "Superuser",
- "value": {
- "is_superuser": true,
- "user_id": "user2"
}
}
}
获取内置数据库认证器中的用户列表。
page | integer >= 1 Default: 1 Example: page=1 要获取的结果所在页码。 |
limit | integer [ 1 .. 10000 ] Default: 100 Example: limit=50 每页返回的结果数量。 |
like_user_id | string 使用用户 ID (username 或 clientid)模糊查询。 |
is_superuser | boolean 是否是超级用户。 |
{- "data": [
- {
- "user_id": "user1"
}, - {
- "is_superuser": true,
- "user_id": "user2"
}
], - "meta": {
- "count": 300,
- "limit": 20,
- "page": 0
}
}
向内置数据库认证器添加用户数据。
is_superuser | boolean Default: false |
password required | string |
user_id required | string |
{- "password": "******",
- "user_id": "user1"
}
{- "user_id": "user1"
}
为内置数据库认证器导入用户数据。
type required | string Enum: "plain" "hash" Example: type=hash The import file template type, enum with |
Import body
[- {
- "is_superuser": true,
- "password": "password1",
- "user_id": "user1"
}, - {
- "is_superuser": false,
- "password": "password2",
- "user_id": "user2"
}
]
{- "failed": 0,
- "override": 0,
- "skipped": 0,
- "success": 0,
- "total": 0
}
查看保留消息列表
topic | string 主题过滤器,支持通配符,省略此项以匹配所有消息。 |
page | integer >= 1 Default: 1 Example: page=1 要获取的结果所在页码。 |
limit | integer [ 1 .. 10000 ] Default: 100 Example: limit=50 每页返回的结果数量。 |
{- "data": [
- {
- "from_clientid": "string",
- "from_username": "string",
- "msgid": "string",
- "publish_at": "string",
- "qos": 0,
- "topic": "string"
}
], - "meta": {
- "count": 0,
- "hasnext": true,
- "limit": 50,
- "page": 1
}
}
当前监控(统计)数据,例如整个集群中的连接数和连接速率。
{- "cluster_sessions": 0,
- "connections": 0,
- "disconnected_durable_sessions": 0,
- "dropped_msg_rate": 0,
- "license_quota": 0,
- "live_connections": 0,
- "persisted_rate": 0,
- "received_msg_rate": 0,
- "retained_msg_count": 0,
- "sent_msg_rate": 0,
- "sessions_hist_hwmark": {
- "current_value": 0,
- "peak_time": 0,
- "peak_value": 0
}, - "shared_subscriptions": 0,
- "subscriptions": 0,
- "subscriptions_durable": 0,
- "topics": 0,
- "transformation_failed_rate": 0,
- "transformation_succeeded_rate": 0,
- "validation_failed_rate": 0,
- "validation_succeeded_rate": 0
}