Merge pull request #12608 from lafirest/fix/iotdb
fix(iotdb): fix function clause error when there is no `payload` field
This commit is contained in:
commit
eaef753c36
|
@ -1,7 +1,7 @@
|
||||||
%% -*- mode: erlang -*-
|
%% -*- mode: erlang -*-
|
||||||
{application, emqx_bridge_iotdb, [
|
{application, emqx_bridge_iotdb, [
|
||||||
{description, "EMQX Enterprise Apache IoTDB Bridge"},
|
{description, "EMQX Enterprise Apache IoTDB Bridge"},
|
||||||
{vsn, "0.1.5"},
|
{vsn, "0.1.6"},
|
||||||
{modules, [
|
{modules, [
|
||||||
emqx_bridge_iotdb,
|
emqx_bridge_iotdb,
|
||||||
emqx_bridge_iotdb_connector
|
emqx_bridge_iotdb_connector
|
||||||
|
|
|
@ -367,6 +367,8 @@ on_get_channel_status(_InstanceId, ChannelId, #{channels := Channels}) ->
|
||||||
get_payload(#{payload := Payload}) ->
|
get_payload(#{payload := Payload}) ->
|
||||||
Payload;
|
Payload;
|
||||||
get_payload(#{<<"payload">> := Payload}) ->
|
get_payload(#{<<"payload">> := Payload}) ->
|
||||||
|
Payload;
|
||||||
|
get_payload(Payload) ->
|
||||||
Payload.
|
Payload.
|
||||||
|
|
||||||
parse_payload(ParsedPayload) when is_map(ParsedPayload) ->
|
parse_payload(ParsedPayload) when is_map(ParsedPayload) ->
|
||||||
|
@ -694,7 +696,7 @@ render_channel_message(#{is_aligned := IsAligned} = Channel, IoTDBVsn, Message)
|
||||||
DeviceId ->
|
DeviceId ->
|
||||||
case get_data_template(Channel, Payloads) of
|
case get_data_template(Channel, Payloads) of
|
||||||
[] ->
|
[] ->
|
||||||
{error, invalid_data};
|
{error, invalid_template};
|
||||||
DataTemplate ->
|
DataTemplate ->
|
||||||
case proc_data(DataTemplate, Message) of
|
case proc_data(DataTemplate, Message) of
|
||||||
{ok, DataList} ->
|
{ok, DataList} ->
|
||||||
|
|
|
@ -502,11 +502,11 @@ t_extract_device_id_from_rule_engine_message(Config) ->
|
||||||
),
|
),
|
||||||
ok.
|
ok.
|
||||||
|
|
||||||
t_sync_invalid_data(Config) ->
|
t_sync_invalid_template(Config) ->
|
||||||
emqx_bridge_v2_testlib:t_sync_query(
|
emqx_bridge_v2_testlib:t_sync_query(
|
||||||
Config,
|
Config,
|
||||||
make_message_fun(iotdb_topic(Config), #{foo => bar, device_id => <<"root.sg27">>}),
|
make_message_fun(iotdb_topic(Config), #{foo => bar, device_id => <<"root.sg27">>}),
|
||||||
is_error_check(invalid_data),
|
is_error_check(invalid_template),
|
||||||
iotdb_bridge_on_query
|
iotdb_bridge_on_query
|
||||||
).
|
).
|
||||||
|
|
||||||
|
@ -518,11 +518,11 @@ t_async_device_id_missing(Config) ->
|
||||||
iotdb_bridge_on_query_async
|
iotdb_bridge_on_query_async
|
||||||
).
|
).
|
||||||
|
|
||||||
t_async_invalid_data(Config) ->
|
t_async_invalid_template(Config) ->
|
||||||
emqx_bridge_v2_testlib:t_async_query(
|
emqx_bridge_v2_testlib:t_async_query(
|
||||||
Config,
|
Config,
|
||||||
make_message_fun(iotdb_topic(Config), #{foo => bar, device_id => <<"root.sg27">>}),
|
make_message_fun(iotdb_topic(Config), #{foo => bar, device_id => <<"root.sg27">>}),
|
||||||
is_error_check(invalid_data),
|
is_error_check(invalid_template),
|
||||||
iotdb_bridge_on_query_async
|
iotdb_bridge_on_query_async
|
||||||
).
|
).
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1 @@
|
||||||
|
Fixed a `function_clause` error for IoTDB action when there is no `payload` field in the query data.
|
Loading…
Reference in New Issue