环境信息
-
EMQX 版本:4.3.11
-
操作系统及版本:Docker 镜像部署 emqx:4.3.11-alpine-amd64
-
其他:MQTTX 客户端,或者emqx 的 dashboard 的 websock 工具发布消息
问题描述
-
Docker 镜像部署 emqx:4.3.11-alpine-amd64
-
登入 http://localhost:18083/ ,配置规则链:
规则 SQL:SELECT * FROM "t/#"
响应动作 :类型: inspect
并关联一个资源 -
通过MQTTX客户端,发送如下消息:
{ "msg":"中文" }
后端日志如下:
cdc-iot-emqx | [inspect]
cdc-iot-emqx | Selected Data: #{clientid => <<"mqttx_d3a1f0b5">>,
cdc-iot-emqx | event => 'message.publish',
cdc-iot-emqx | flags => #{dup => false,retain => false},
cdc-iot-emqx | headers =>
cdc-iot-emqx | #{peerhost => <<"172.18.0.1">>,properties => #{},
cdc-iot-emqx | proto_ver => 4,protocol => mqtt,
cdc-iot-emqx | username => <<"u-emqx-client">>},
cdc-iot-emqx | id => <<"0005D9C42C7D2C22BCDA00000D750001">>,
cdc-iot-emqx | metadata => #{rule_id => <<"rule:235895">>},
cdc-iot-emqx | node => '7a9b273680fe@172.18.0.2',
cdc-iot-emqx | payload =>
cdc-iot-emqx | <<123,10,32,32,34,109,115,103,34,58,34,228,184,
cdc-iot-emqx | 173,230,150,135,34,10,125>>,
cdc-iot-emqx | peerhost => <<"172.18.0.1">>,pub_props => #{},
cdc-iot-emqx | publish_received_at => 1646811466771,qos => 1,
cdc-iot-emqx | timestamp => 1646811466771,topic => <<"t/a">>,
cdc-iot-emqx | username => <<"u-emqx-client">>}
cdc-iot-emqx | Envs: #{'__bindings__' =>
cdc-iot-emqx | #{'Id' => <<"inspect_1646638394825865500">>,
cdc-iot-emqx | 'Params' => #{}},
cdc-iot-emqx | clientid => <<"mqttx_d3a1f0b5">>,event => 'message.publish',
cdc-iot-emqx | flags => #{dup => false,retain => false},
cdc-iot-emqx | headers =>
cdc-iot-emqx | #{peerhost => <<"172.18.0.1">>,properties => #{},
cdc-iot-emqx | proto_ver => 4,protocol => mqtt,
cdc-iot-emqx | username => <<"u-emqx-client">>},
cdc-iot-emqx | id => <<"0005D9C42C7D2C22BCDA00000D750001">>,
cdc-iot-emqx | metadata => #{rule_id => <<"rule:235895">>},
cdc-iot-emqx | node => '7a9b273680fe@172.18.0.2',
cdc-iot-emqx | payload =>
cdc-iot-emqx | <<123,10,32,32,34,109,115,103,34,58,34,228,184,173,230,150,
cdc-iot-emqx | 135,34,10,125>>,
cdc-iot-emqx | peerhost => <<"172.18.0.1">>,pub_props => #{},
cdc-iot-emqx | publish_received_at => 1646811466771,qos => 1,
cdc-iot-emqx | timestamp => 1646811466771,topic => <<"t/a">>,
cdc-iot-emqx | username => <<"u-emqx-client">>}
cdc-iot-emqx | Action Init Params: #{}
其中 payload => <<123,10,32,32,34,109,115,103,34,58,34,228,184, 173,230,150,135,34,10,125>>
, 是乱码, 后续的响应动作无法进行payload数据选择,完成规定动作.
但客户端发送消息没有中文,就是好. 发送的消息如下:
{
"msg":"chinese"
}
后端日志如下:
| [inspect]
cdc-iot-emqx | Selected Data: #{clientid => <<"mqttx_d3a1f0b5">>,
cdc-iot-emqx | event => 'message.publish',
cdc-iot-emqx | flags => #{dup => false,retain => false},
cdc-iot-emqx | headers =>
cdc-iot-emqx | #{peerhost => <<"172.18.0.1">>,properties => #{},
cdc-iot-emqx | proto_ver => 4,protocol => mqtt,
cdc-iot-emqx | username => <<"u-emqx-client">>},
cdc-iot-emqx | id => <<"0005D9C446664B53BCDA00000D750002">>,
cdc-iot-emqx | metadata => #{rule_id => <<"rule:235895">>},
cdc-iot-emqx | node => '7a9b273680fe@172.18.0.2',
cdc-iot-emqx | payload => <<"{\n \"msg\":\"chinese\"\n}">>,
cdc-iot-emqx | peerhost => <<"172.18.0.1">>,pub_props => #{},
cdc-iot-emqx | publish_received_at => 1646811901479,qos => 1,
cdc-iot-emqx | timestamp => 1646811901479,topic => <<"t/a">>,
cdc-iot-emqx | username => <<"u-emqx-client">>}
cdc-iot-emqx | Envs: #{'__bindings__' =>
cdc-iot-emqx | #{'Id' => <<"inspect_1646638394825865500">>,
cdc-iot-emqx | 'Params' => #{}},
cdc-iot-emqx | clientid => <<"mqttx_d3a1f0b5">>,event => 'message.publish',
cdc-iot-emqx | flags => #{dup => false,retain => false},
cdc-iot-emqx | headers =>
cdc-iot-emqx | #{peerhost => <<"172.18.0.1">>,properties => #{},
cdc-iot-emqx | proto_ver => 4,protocol => mqtt,
cdc-iot-emqx | username => <<"u-emqx-client">>},
cdc-iot-emqx | id => <<"0005D9C446664B53BCDA00000D750002">>,
cdc-iot-emqx | metadata => #{rule_id => <<"rule:235895">>},
cdc-iot-emqx | node => '7a9b273680fe@172.18.0.2',
cdc-iot-emqx | payload => <<"{\n \"msg\":\"chinese\"\n}">>,
cdc-iot-emqx | peerhost => <<"172.18.0.1">>,pub_props => #{},
cdc-iot-emqx | publish_received_at => 1646811901479,qos => 1,
cdc-iot-emqx | timestamp => 1646811901479,topic => <<"t/a">>,
cdc-iot-emqx | username => <<"u-emqx-client">>}
cdc-iot-emqx | Action Init Params: #{}
其中的payload: payload => <<"{\n \"msg\":\"chinese\"\n}">>
,则是好的.
日志: