refactor(hstreamdb): HStreamDB bridge to its own application

This commit is contained in:
JimMoen 2023-06-29 15:49:16 +08:00
parent ab809c8b85
commit d31a305bcb
No known key found for this signature in database
GPG Key ID: 87A520B4F76BA86D
10 changed files with 23 additions and 13 deletions

View File

@ -0,0 +1,11 @@
%% -*- mode: erlang -*-
{erl_opts, [debug_info]}.
{deps, [
{hstreamdb_erl, {git, "https://github.com/hstreamdb/hstreamdb_erl.git", {tag, "0.2.5"}}},
{emqx, {path, "../../apps/emqx"}},
{emqx_utils, {path, "../../apps/emqx_utils"}}
]}.
{shell, [
{apps, [emqx_bridge_hstreamdb]}
]}.

View File

@ -1,6 +1,6 @@
{application, emqx_bridge_hstreamdb, [ {application, emqx_bridge_hstreamdb, [
{description, "EMQX Enterprise HStreamDB Bridge"}, {description, "EMQX Enterprise HStreamDB Bridge"},
{vsn, "0.1.0"}, {vsn, "0.1.1"},
{registered, []}, {registered, []},
{applications, [kernel, stdlib]}, {applications, [kernel, stdlib]},
{env, []}, {env, []},

View File

@ -1,7 +1,7 @@
%%-------------------------------------------------------------------- %%--------------------------------------------------------------------
%% Copyright (c) 2022-2023 EMQ Technologies Co., Ltd. All Rights Reserved. %% Copyright (c) 2022-2023 EMQ Technologies Co., Ltd. All Rights Reserved.
%%-------------------------------------------------------------------- %%--------------------------------------------------------------------
-module(emqx_ee_bridge_hstreamdb). -module(emqx_bridge_hstreamdb).
-include_lib("typerefl/include/types.hrl"). -include_lib("typerefl/include/types.hrl").
-include_lib("hocon/include/hoconsc.hrl"). -include_lib("hocon/include/hoconsc.hrl").
@ -66,7 +66,7 @@ fields("get") ->
field(connector) -> field(connector) ->
mk( mk(
hoconsc:union([binary(), ref(emqx_ee_connector_hstreamdb, config)]), hoconsc:union([binary(), ref(emqx_bridge_hstreamdb_connector, config)]),
#{ #{
required => true, required => true,
example => <<"hstreamdb:demo">>, example => <<"hstreamdb:demo">>,

View File

@ -1,7 +1,7 @@
%%-------------------------------------------------------------------- %%--------------------------------------------------------------------
%% Copyright (c) 2022-2023 EMQ Technologies Co., Ltd. All Rights Reserved. %% Copyright (c) 2022-2023 EMQ Technologies Co., Ltd. All Rights Reserved.
%%-------------------------------------------------------------------- %%--------------------------------------------------------------------
-module(emqx_ee_connector_hstreamdb). -module(emqx_bridge_hstreamdb_connector).
-include_lib("hocon/include/hoconsc.hrl"). -include_lib("hocon/include/hoconsc.hrl").
-include_lib("typerefl/include/types.hrl"). -include_lib("typerefl/include/types.hrl").

View File

@ -2,7 +2,7 @@
%% Copyright (c) 2022-2023 EMQ Technologies Co., Ltd. All Rights Reserved. %% Copyright (c) 2022-2023 EMQ Technologies Co., Ltd. All Rights Reserved.
%%-------------------------------------------------------------------- %%--------------------------------------------------------------------
-module(ee_bridge_hstreamdb_SUITE). -module(emqx_bridge_hstreamdb_SUITE).
-compile(nowarn_export_all). -compile(nowarn_export_all).
-compile(export_all). -compile(export_all).

View File

@ -2,7 +2,7 @@
%% Copyright (c) 2022-2023 EMQ Technologies Co., Ltd. All Rights Reserved. %% Copyright (c) 2022-2023 EMQ Technologies Co., Ltd. All Rights Reserved.
%%-------------------------------------------------------------------- %%--------------------------------------------------------------------
-module(emqx_ee_connector_hstreamdb_SUITE). -module(emqx_connector_hstreamdb_SUITE).
-compile(nowarn_export_all). -compile(nowarn_export_all).
-compile(export_all). -compile(export_all).

View File

@ -30,7 +30,7 @@ api_schemas(Method) ->
api_ref(emqx_bridge_mongodb, <<"mongodb_rs">>, Method ++ "_rs"), api_ref(emqx_bridge_mongodb, <<"mongodb_rs">>, Method ++ "_rs"),
api_ref(emqx_bridge_mongodb, <<"mongodb_sharded">>, Method ++ "_sharded"), api_ref(emqx_bridge_mongodb, <<"mongodb_sharded">>, Method ++ "_sharded"),
api_ref(emqx_bridge_mongodb, <<"mongodb_single">>, Method ++ "_single"), api_ref(emqx_bridge_mongodb, <<"mongodb_single">>, Method ++ "_single"),
api_ref(emqx_ee_bridge_hstreamdb, <<"hstreamdb">>, Method), api_ref(emqx_bridge_hstreamdb, <<"hstreamdb">>, Method),
api_ref(emqx_bridge_influxdb, <<"influxdb_api_v1">>, Method ++ "_api_v1"), api_ref(emqx_bridge_influxdb, <<"influxdb_api_v1">>, Method ++ "_api_v1"),
api_ref(emqx_bridge_influxdb, <<"influxdb_api_v2">>, Method ++ "_api_v2"), api_ref(emqx_bridge_influxdb, <<"influxdb_api_v2">>, Method ++ "_api_v2"),
api_ref(emqx_bridge_redis, <<"redis_single">>, Method ++ "_single"), api_ref(emqx_bridge_redis, <<"redis_single">>, Method ++ "_single"),
@ -54,7 +54,7 @@ schema_modules() ->
[ [
emqx_bridge_kafka, emqx_bridge_kafka,
emqx_bridge_cassandra, emqx_bridge_cassandra,
emqx_ee_bridge_hstreamdb, emqx_bridge_hstreamdb,
emqx_bridge_gcp_pubsub, emqx_bridge_gcp_pubsub,
emqx_bridge_influxdb, emqx_bridge_influxdb,
emqx_bridge_mongodb, emqx_bridge_mongodb,
@ -93,7 +93,7 @@ resource_type(kafka_consumer) -> emqx_bridge_kafka_impl_consumer;
%% to hocon; keeping this as just `kafka' for backwards compatibility. %% to hocon; keeping this as just `kafka' for backwards compatibility.
resource_type(kafka) -> emqx_bridge_kafka_impl_producer; resource_type(kafka) -> emqx_bridge_kafka_impl_producer;
resource_type(cassandra) -> emqx_bridge_cassandra_connector; resource_type(cassandra) -> emqx_bridge_cassandra_connector;
resource_type(hstreamdb) -> emqx_ee_connector_hstreamdb; resource_type(hstreamdb) -> emqx_bridge_hstreamdb_connector;
resource_type(gcp_pubsub) -> emqx_bridge_gcp_pubsub_impl_producer; resource_type(gcp_pubsub) -> emqx_bridge_gcp_pubsub_impl_producer;
resource_type(gcp_pubsub_consumer) -> emqx_bridge_gcp_pubsub_impl_consumer; resource_type(gcp_pubsub_consumer) -> emqx_bridge_gcp_pubsub_impl_consumer;
resource_type(mongodb_rs) -> emqx_bridge_mongodb_connector; resource_type(mongodb_rs) -> emqx_bridge_mongodb_connector;
@ -123,7 +123,7 @@ fields(bridges) ->
[ [
{hstreamdb, {hstreamdb,
mk( mk(
hoconsc:map(name, ref(emqx_ee_bridge_hstreamdb, "config")), hoconsc:map(name, ref(emqx_bridge_hstreamdb, "config")),
#{ #{
desc => <<"HStreamDB Bridge Config">>, desc => <<"HStreamDB Bridge Config">>,
required => false required => false

View File

@ -1,7 +1,6 @@
%% -*- mode: erlang -*- %% -*- mode: erlang -*-
{erl_opts, [debug_info]}. {erl_opts, [debug_info]}.
{deps, [ {deps, [
{hstreamdb_erl, {git, "https://github.com/hstreamdb/hstreamdb_erl.git", {tag, "0.2.5"}}},
{emqx, {path, "../../apps/emqx"}}, {emqx, {path, "../../apps/emqx"}},
{emqx_utils, {path, "../../apps/emqx_utils"}} {emqx_utils, {path, "../../apps/emqx_utils"}}
]}. ]}.

View File

@ -1,4 +1,4 @@
emqx_ee_bridge_hstreamdb { emqx_bridge_hstreamdb {
config_direction.desc: config_direction.desc:
"""The direction of this bridge, MUST be 'egress'""" """The direction of this bridge, MUST be 'egress'"""

View File

@ -1,4 +1,4 @@
emqx_ee_connector_hstreamdb { emqx_bridge_hstreamdb_connector {
config.desc: config.desc:
"""HStreamDB connection config""" """HStreamDB connection config"""