style: cleanup emqx_connector_resource

This commit is contained in:
Stefan Strigler 2023-10-02 16:22:06 +02:00 committed by Zaiming (Stone) Shi
parent 99904cab27
commit 16d7f4d3e6
1 changed files with 0 additions and 21 deletions

View File

@ -39,7 +39,6 @@
remove/1, remove/1,
remove/2, remove/2,
remove/4, remove/4,
reset_metrics/1,
restart/2, restart/2,
start/2, start/2,
stop/2, stop/2,
@ -54,16 +53,6 @@ when
ParsedConfig :: #{atom() => any()}. ParsedConfig :: #{atom() => any()}.
-optional_callbacks([connector_config/2]). -optional_callbacks([connector_config/2]).
%% bi-directional connector with producer/consumer or ingress/egress configs
-define(IS_BI_DIR_CONNECTOR(TYPE),
(TYPE) =:= <<"mqtt">>
).
-define(IS_INGRESS_CONNECTOR(TYPE),
(TYPE) =:= <<"kafka_consumer">> orelse
(TYPE) =:= <<"gcp_pubsub_consumer">> orelse
?IS_BI_DIR_CONNECTOR(TYPE)
).
-if(?EMQX_RELEASE_EDITION == ee). -if(?EMQX_RELEASE_EDITION == ee).
connector_to_resource_type(ConnectorType) -> emqx_connector_ee_schema:resource_type(ConnectorType). connector_to_resource_type(ConnectorType) -> emqx_connector_ee_schema:resource_type(ConnectorType).
@ -152,9 +141,6 @@ to_type_atom(Type) ->
invalid_data(<<"unknown connector type: ", Type/binary>>) invalid_data(<<"unknown connector type: ", Type/binary>>)
end. end.
reset_metrics(ResourceId) ->
emqx_resource:reset_metrics(ResourceId).
restart(Type, Name) -> restart(Type, Name) ->
emqx_resource:restart(resource_id(Type, Name)). emqx_resource:restart(resource_id(Type, Name)).
@ -377,13 +363,6 @@ parse_confs(<<"iotdb">>, Name, Conf) ->
Name, Name,
WebhookConfig WebhookConfig
); );
parse_confs(Type, Name, Conf) when ?IS_INGRESS_CONNECTOR(Type) ->
%% For some drivers that can be used as data-sources, we need to provide a
%% hookpoint. The underlying driver will run `emqx_hooks:run/3` when it
%% receives a message from the external database.
BId = connector_id(Type, Name),
ConnectorHookpoint = connector_hookpoint(BId),
Conf#{hookpoint => ConnectorHookpoint, connector_name => Name};
%% TODO: rename this to `kafka_producer' after alias support is added %% TODO: rename this to `kafka_producer' after alias support is added
%% to hocon; keeping this as just `kafka' for backwards compatibility. %% to hocon; keeping this as just `kafka' for backwards compatibility.
parse_confs(<<"kafka">> = _Type, Name, Conf) -> parse_confs(<<"kafka">> = _Type, Name, Conf) ->