Merge pull request #7098 from HJianBo/autosubs
Gateway should ignore the `{subscribe, TopicTabels}` message produced by auto-subscribe module
This commit is contained in:
commit
073743cd57
2
Makefile
2
Makefile
|
@ -8,7 +8,7 @@ export EMQX_DEFAULT_BUILDER = ghcr.io/emqx/emqx-builder/5.0-5:1.13.2-24.1.5-4-al
|
||||||
export EMQX_DEFAULT_RUNNER = alpine:3.14
|
export EMQX_DEFAULT_RUNNER = alpine:3.14
|
||||||
export OTP_VSN ?= $(shell $(CURDIR)/scripts/get-otp-vsn.sh)
|
export OTP_VSN ?= $(shell $(CURDIR)/scripts/get-otp-vsn.sh)
|
||||||
export ELIXIR_VSN ?= $(shell $(CURDIR)/scripts/get-elixir-vsn.sh)
|
export ELIXIR_VSN ?= $(shell $(CURDIR)/scripts/get-elixir-vsn.sh)
|
||||||
export EMQX_DASHBOARD_VERSION ?= v0.19.0
|
export EMQX_DASHBOARD_VERSION ?= v0.20.0
|
||||||
export DOCKERFILE := deploy/docker/Dockerfile
|
export DOCKERFILE := deploy/docker/Dockerfile
|
||||||
export DOCKERFILE_TESTING := deploy/docker/Dockerfile.testing
|
export DOCKERFILE_TESTING := deploy/docker/Dockerfile.testing
|
||||||
ifeq ($(OS),Windows_NT)
|
ifeq ($(OS),Windows_NT)
|
||||||
|
|
|
@ -60,8 +60,12 @@ test(_) ->
|
||||||
%% hook
|
%% hook
|
||||||
|
|
||||||
on_client_connected(ClientInfo, ConnInfo, {TopicHandler, Options}) ->
|
on_client_connected(ClientInfo, ConnInfo, {TopicHandler, Options}) ->
|
||||||
TopicTables = erlang:apply(TopicHandler, handle, [ClientInfo, ConnInfo, Options]),
|
case erlang:apply(TopicHandler, handle, [ClientInfo, ConnInfo, Options]) of
|
||||||
self() ! {subscribe, TopicTables};
|
[] -> ok;
|
||||||
|
TopicTables ->
|
||||||
|
_ = self() ! {subscribe, TopicTables},
|
||||||
|
ok
|
||||||
|
end;
|
||||||
on_client_connected(_, _, _) ->
|
on_client_connected(_, _, _) ->
|
||||||
ok.
|
ok.
|
||||||
|
|
||||||
|
|
|
@ -423,6 +423,9 @@ handle_info({hreply, FunName, ok}, Channel)
|
||||||
handle_info({hreply, FunName, {error, Reason}}, Channel) ->
|
handle_info({hreply, FunName, {error, Reason}}, Channel) ->
|
||||||
{shutdown, {error, {FunName, Reason}}, Channel};
|
{shutdown, {error, {FunName, Reason}}, Channel};
|
||||||
|
|
||||||
|
handle_info({subscribe, _}, Channel) ->
|
||||||
|
{ok, Channel};
|
||||||
|
|
||||||
handle_info(Info, Channel) ->
|
handle_info(Info, Channel) ->
|
||||||
?SLOG(warning, #{ msg => "unexpected_info"
|
?SLOG(warning, #{ msg => "unexpected_info"
|
||||||
, info => Info
|
, info => Info
|
||||||
|
|
|
@ -1296,6 +1296,9 @@ handle_info(clean_authz_cache, Channel) ->
|
||||||
ok = emqx_authz_cache:empty_authz_cache(),
|
ok = emqx_authz_cache:empty_authz_cache(),
|
||||||
{ok, Channel};
|
{ok, Channel};
|
||||||
|
|
||||||
|
handle_info({subscribe, _}, Channel) ->
|
||||||
|
{ok, Channel};
|
||||||
|
|
||||||
handle_info(Info, Channel) ->
|
handle_info(Info, Channel) ->
|
||||||
?SLOG(error, #{ msg => "unexpected_info"
|
?SLOG(error, #{ msg => "unexpected_info"
|
||||||
, info => Info
|
, info => Info
|
||||||
|
|
|
@ -777,6 +777,9 @@ handle_info(clean_authz_cache, Channel) ->
|
||||||
ok = emqx_authz_cache:empty_authz_cache(),
|
ok = emqx_authz_cache:empty_authz_cache(),
|
||||||
{ok, Channel};
|
{ok, Channel};
|
||||||
|
|
||||||
|
handle_info({subscribe, _}, Channel) ->
|
||||||
|
{ok, Channel};
|
||||||
|
|
||||||
handle_info(Info, Channel) ->
|
handle_info(Info, Channel) ->
|
||||||
?SLOG(error, #{ msg => "unexpected_info"
|
?SLOG(error, #{ msg => "unexpected_info"
|
||||||
, info => Info
|
, info => Info
|
||||||
|
|
|
@ -15,10 +15,11 @@
|
||||||
%%--------------------------------------------------------------------
|
%%--------------------------------------------------------------------
|
||||||
-module(emqx_event_message_api).
|
-module(emqx_event_message_api).
|
||||||
|
|
||||||
|
-include("emqx_modules.hrl").
|
||||||
|
|
||||||
-behaviour(minirest_api).
|
-behaviour(minirest_api).
|
||||||
|
|
||||||
-import(hoconsc, [mk/2, ref/2]).
|
-import(hoconsc, [mk/2, ref/2]).
|
||||||
-include("emqx_modules.hrl").
|
|
||||||
|
|
||||||
-export([ api_spec/0
|
-export([ api_spec/0
|
||||||
, paths/0
|
, paths/0
|
||||||
|
|
Loading…
Reference in New Issue