chore: drop templating support for `Subscription-Identifier`

This is highly-dependent on the session state, as is `Topic-Alias`.
This commit is contained in:
Thales Macedo Garitezi 2023-09-06 15:25:52 -03:00
parent 47bd19dee4
commit 02b8bbf76a
3 changed files with 8 additions and 16 deletions

View File

@ -188,9 +188,7 @@ fields("republish_mqtt_properties") ->
{'Content-Type', ?HOCON(binary(), #{required => false, desc => ?DESC('Content-Type')})},
{'Response-Topic', ?HOCON(binary(), #{required => false, desc => ?DESC('Response-Topic')})},
{'Correlation-Data',
?HOCON(binary(), #{required => false, desc => ?DESC('Correlation-Data')})},
{'Subscription-Identifier',
?HOCON(binary(), #{required => false, desc => ?DESC('Subscription-Identifier')})}
?HOCON(binary(), #{required => false, desc => ?DESC('Correlation-Data')})}
].
desc("rule_engine") ->

View File

@ -1424,8 +1424,7 @@ t_sqlselect_03(_Config) ->
<<"Message-Expiry-Interval">> => <<"${.payload.mei}">>,
<<"Content-Type">> => <<"${.payload.ct}">>,
<<"Response-Topic">> => <<"${.payload.rt}">>,
<<"Correlation-Data">> => <<"${.payload.cd}">>,
<<"Subscription-Identifier">> => <<"${.payload.si}">>
<<"Correlation-Data">> => <<"${.payload.cd}">>
}
),
RepubRaw = emqx_utils_maps:binary_key_map(Repub#{function => <<"republish">>}),
@ -1462,9 +1461,7 @@ t_sqlselect_03(_Config) ->
mei => 2,
ct => <<"3">>,
rt => <<"4">>,
cd => <<"5">>,
si => 6,
ta => 7
cd => <<"5">>
}
),
{ok, Client} = emqtt:start_link([
@ -1482,7 +1479,6 @@ t_sqlselect_03(_Config) ->
'Content-Type' => <<"3">>,
'Response-Topic' => <<"4">>,
'Correlation-Data' => <<"5">>,
'Subscription-Identifier' => 6,
%% currently, `Topic-Alias' is dropped `emqx_message:filter_pub_props',
%% so the channel controls those aliases on its own, starting from 1.
'Topic-Alias' => 1,
@ -1503,7 +1499,6 @@ t_sqlselect_03(_Config) ->
'Content-Type' => <<"3">>,
'Response-Topic' => <<"4">>,
'Correlation-Data' => <<"5">>,
'Subscription-Identifier' => 6,
'User-Property' => maps:from_list(UserProps),
'User-Property-Pairs' => [
#{key => K, value => V}
@ -1524,6 +1519,9 @@ t_sqlselect_03(_Config) ->
ct:pal("testing payload that is not a json object"),
emqtt:publish(Client, <<"t/r">>, PubProps, <<"not-a-map">>, [{qos, 0}]),
ExpectedMQTTProps2 = #{
'Content-Type' => <<"undefined">>,
'Correlation-Data' => <<"undefined">>,
'Response-Topic' => <<"undefined">>,
%% currently, `Topic-Alias' is dropped `emqx_message:filter_pub_props',
%% so the channel controls those aliases on its own, starting from 1.
'Topic-Alias' => 1,
@ -1548,9 +1546,7 @@ t_sqlselect_03(_Config) ->
mei => <<"bad_value2">>,
ct => <<"some_value3">>,
rt => <<"some_value4">>,
cd => <<"some_value5">>,
si => <<"bad_value6">>,
ta => <<"bad_value7">>
cd => <<"some_value5">>
}),
emqtt:publish(Client, <<"t/r">>, PubProps, Payload1, [{qos, 0}]),
ExpectedMQTTProps3 = #{

View File

@ -43,7 +43,6 @@ rule_engine.rules.my_rule {
\"Content-Type\" = \"${.payload.ct}\"
\"Response-Topic\" = \"${.payload.rt}\"
\"Correlation-Data\" = \"${.payload.cd}\"
\"Subscription-Identifier\" = \"${.payload.si}\"
}
user_properties = \"${pub_props.'User-Property'}\"
}
@ -113,8 +112,7 @@ republish_test_() ->
<<"Message-Expiry-Interval">> := <<_/binary>>,
<<"Content-Type">> := <<_/binary>>,
<<"Response-Topic">> := <<_/binary>>,
<<"Correlation-Data">> := <<_/binary>>,
<<"Subscription-Identifier">> := <<_/binary>>
<<"Correlation-Data">> := <<_/binary>>
}
}
},