refactor(cassandra): move cassandra bridge into its own app
This commit is contained in:
parent
6532cfb337
commit
bdce32e713
|
@ -0,0 +1,2 @@
|
||||||
|
toxiproxy
|
||||||
|
cassandra
|
|
@ -0,0 +1,11 @@
|
||||||
|
%% -*- mode: erlang; -*-
|
||||||
|
{erl_opts, [debug_info]}.
|
||||||
|
{deps, [ {ecql, {git, "https://github.com/emqx/ecql.git", {tag, "v0.5.1"}}}
|
||||||
|
, {emqx_connector, {path, "../../apps/emqx_connector"}}
|
||||||
|
, {emqx_resource, {path, "../../apps/emqx_resource"}}
|
||||||
|
, {emqx_bridge, {path, "../../apps/emqx_bridge"}}
|
||||||
|
]}.
|
||||||
|
|
||||||
|
{shell, [
|
||||||
|
{apps, [emqx_bridge_cassandra]}
|
||||||
|
]}.
|
|
@ -2,7 +2,7 @@
|
||||||
{description, "EMQX Enterprise Cassandra Bridge"},
|
{description, "EMQX Enterprise Cassandra Bridge"},
|
||||||
{vsn, "0.1.0"},
|
{vsn, "0.1.0"},
|
||||||
{registered, []},
|
{registered, []},
|
||||||
{applications, [kernel, stdlib]},
|
{applications, [kernel, stdlib, ecql]},
|
||||||
{env, []},
|
{env, []},
|
||||||
{modules, []},
|
{modules, []},
|
||||||
{links, []}
|
{links, []}
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
%%--------------------------------------------------------------------
|
%%--------------------------------------------------------------------
|
||||||
%% Copyright (c) 2023 EMQ Technologies Co., Ltd. All Rights Reserved.
|
%% Copyright (c) 2023 EMQ Technologies Co., Ltd. All Rights Reserved.
|
||||||
%%--------------------------------------------------------------------
|
%%--------------------------------------------------------------------
|
||||||
-module(emqx_ee_bridge_cassa).
|
-module(emqx_bridge_cassandra).
|
||||||
|
|
||||||
-include_lib("typerefl/include/types.hrl").
|
-include_lib("typerefl/include/types.hrl").
|
||||||
-include_lib("hocon/include/hoconsc.hrl").
|
-include_lib("hocon/include/hoconsc.hrl").
|
||||||
|
@ -88,7 +88,7 @@ fields("config") ->
|
||||||
#{desc => ?DESC("local_topic"), default => undefined}
|
#{desc => ?DESC("local_topic"), default => undefined}
|
||||||
)}
|
)}
|
||||||
] ++ emqx_resource_schema:fields("resource_opts") ++
|
] ++ emqx_resource_schema:fields("resource_opts") ++
|
||||||
(emqx_ee_connector_cassa:fields(config) --
|
(emqx_bridge_cassandra_impl:fields(config) --
|
||||||
emqx_connector_schema_lib:prepare_statement_fields());
|
emqx_connector_schema_lib:prepare_statement_fields());
|
||||||
fields("post") ->
|
fields("post") ->
|
||||||
fields("post", cassandra);
|
fields("post", cassandra);
|
|
@ -2,7 +2,7 @@
|
||||||
%% Copyright (c) 2023 EMQ Technologies Co., Ltd. All Rights Reserved.
|
%% Copyright (c) 2023 EMQ Technologies Co., Ltd. All Rights Reserved.
|
||||||
%%--------------------------------------------------------------------
|
%%--------------------------------------------------------------------
|
||||||
|
|
||||||
-module(emqx_ee_connector_cassa).
|
-module(emqx_bridge_cassandra_impl).
|
||||||
|
|
||||||
-behaviour(emqx_resource).
|
-behaviour(emqx_resource).
|
||||||
|
|
|
@ -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_bridge_cassa_SUITE).
|
-module(emqx_bridge_cassandra_SUITE).
|
||||||
|
|
||||||
-compile(nowarn_export_all).
|
-compile(nowarn_export_all).
|
||||||
-compile(export_all).
|
-compile(export_all).
|
||||||
|
@ -57,7 +57,7 @@
|
||||||
%% CASSA_TCP_HOST=127.0.0.1 CASSA_TCP_PORT=19042 \
|
%% CASSA_TCP_HOST=127.0.0.1 CASSA_TCP_PORT=19042 \
|
||||||
%% CASSA_TLS_HOST=127.0.0.1 CASSA_TLS_PORT=19142 \
|
%% CASSA_TLS_HOST=127.0.0.1 CASSA_TLS_PORT=19142 \
|
||||||
%% PROXY_HOST=127.0.0.1 ./rebar3 as test ct -c -v --name ct@127.0.0.1 \
|
%% PROXY_HOST=127.0.0.1 ./rebar3 as test ct -c -v --name ct@127.0.0.1 \
|
||||||
%% --suite lib-ee/emqx_ee_bridge/test/emqx_ee_bridge_cassa_SUITE.erl
|
%% --suite apps/emqx_bridge_cassandra/test/emqx_bridge_cassandra_SUITE.erl
|
||||||
%%
|
%%
|
||||||
|
|
||||||
%%------------------------------------------------------------------------------
|
%%------------------------------------------------------------------------------
|
||||||
|
@ -590,7 +590,7 @@ t_missing_data(Config) ->
|
||||||
{ok, _},
|
{ok, _},
|
||||||
create_bridge(Config)
|
create_bridge(Config)
|
||||||
),
|
),
|
||||||
%% emqx_ee_connector_cassa will send missed data as a `null` atom
|
%% emqx_bridge_cassandra_impl will send missed data as a `null` atom
|
||||||
%% to ecql driver
|
%% to ecql driver
|
||||||
?check_trace(
|
?check_trace(
|
||||||
begin
|
begin
|
|
@ -2,7 +2,7 @@
|
||||||
%% Copyright (c) 2023 EMQ Technologies Co., Ltd. All Rights Reserved.
|
%% Copyright (c) 2023 EMQ Technologies Co., Ltd. All Rights Reserved.
|
||||||
%%--------------------------------------------------------------------
|
%%--------------------------------------------------------------------
|
||||||
|
|
||||||
-module(emqx_ee_connector_cassa_SUITE).
|
-module(emqx_bridge_cassandra_impl_SUITE).
|
||||||
|
|
||||||
-compile(nowarn_export_all).
|
-compile(nowarn_export_all).
|
||||||
-compile(export_all).
|
-compile(export_all).
|
||||||
|
@ -16,7 +16,7 @@
|
||||||
%% Cassandra server defined at `.ci/docker-compose-file/docker-compose-cassandra-tcp.yaml`
|
%% Cassandra server defined at `.ci/docker-compose-file/docker-compose-cassandra-tcp.yaml`
|
||||||
%% You can change it to `127.0.0.1`, if you run this SUITE locally
|
%% You can change it to `127.0.0.1`, if you run this SUITE locally
|
||||||
-define(CASSANDRA_HOST, "cassandra").
|
-define(CASSANDRA_HOST, "cassandra").
|
||||||
-define(CASSANDRA_RESOURCE_MOD, emqx_ee_connector_cassa).
|
-define(CASSANDRA_RESOURCE_MOD, emqx_bridge_cassandra_impl).
|
||||||
|
|
||||||
%% This test SUITE requires a running cassandra instance. If you don't want to
|
%% This test SUITE requires a running cassandra instance. If you don't want to
|
||||||
%% bring up the whole CI infrastuctucture with the `scripts/ct/run.sh` script
|
%% bring up the whole CI infrastuctucture with the `scripts/ct/run.sh` script
|
|
@ -10,5 +10,4 @@ tdengine
|
||||||
clickhouse
|
clickhouse
|
||||||
dynamo
|
dynamo
|
||||||
rocketmq
|
rocketmq
|
||||||
cassandra
|
|
||||||
sqlserver
|
sqlserver
|
||||||
|
|
|
@ -1,6 +1,5 @@
|
||||||
{erl_opts, [debug_info]}.
|
{erl_opts, [debug_info]}.
|
||||||
{deps, [ {ecql, {git, "https://github.com/emqx/ecql.git", {tag, "v0.5.1"}}}
|
{deps, [ {emqx_connector, {path, "../../apps/emqx_connector"}}
|
||||||
, {emqx_connector, {path, "../../apps/emqx_connector"}}
|
|
||||||
, {emqx_resource, {path, "../../apps/emqx_resource"}}
|
, {emqx_resource, {path, "../../apps/emqx_resource"}}
|
||||||
, {emqx_bridge, {path, "../../apps/emqx_bridge"}}
|
, {emqx_bridge, {path, "../../apps/emqx_bridge"}}
|
||||||
, {emqx_utils, {path, "../emqx_utils"}}
|
, {emqx_utils, {path, "../emqx_utils"}}
|
||||||
|
|
|
@ -17,6 +17,7 @@ api_schemas(Method) ->
|
||||||
ref(emqx_bridge_gcp_pubsub, Method),
|
ref(emqx_bridge_gcp_pubsub, Method),
|
||||||
ref(emqx_bridge_kafka, Method ++ "_consumer"),
|
ref(emqx_bridge_kafka, Method ++ "_consumer"),
|
||||||
ref(emqx_bridge_kafka, Method ++ "_producer"),
|
ref(emqx_bridge_kafka, Method ++ "_producer"),
|
||||||
|
ref(emqx_bridge_cassandra, Method),
|
||||||
ref(emqx_ee_bridge_mysql, Method),
|
ref(emqx_ee_bridge_mysql, Method),
|
||||||
ref(emqx_ee_bridge_pgsql, Method),
|
ref(emqx_ee_bridge_pgsql, Method),
|
||||||
ref(emqx_ee_bridge_mongodb, Method ++ "_rs"),
|
ref(emqx_ee_bridge_mongodb, Method ++ "_rs"),
|
||||||
|
@ -34,13 +35,13 @@ api_schemas(Method) ->
|
||||||
ref(emqx_ee_bridge_clickhouse, Method),
|
ref(emqx_ee_bridge_clickhouse, Method),
|
||||||
ref(emqx_ee_bridge_dynamo, Method),
|
ref(emqx_ee_bridge_dynamo, Method),
|
||||||
ref(emqx_ee_bridge_rocketmq, Method),
|
ref(emqx_ee_bridge_rocketmq, Method),
|
||||||
ref(emqx_ee_bridge_cassa, Method),
|
|
||||||
ref(emqx_ee_bridge_sqlserver, Method)
|
ref(emqx_ee_bridge_sqlserver, Method)
|
||||||
].
|
].
|
||||||
|
|
||||||
schema_modules() ->
|
schema_modules() ->
|
||||||
[
|
[
|
||||||
emqx_bridge_kafka,
|
emqx_bridge_kafka,
|
||||||
|
emqx_bridge_cassandra,
|
||||||
emqx_ee_bridge_hstreamdb,
|
emqx_ee_bridge_hstreamdb,
|
||||||
emqx_bridge_gcp_pubsub,
|
emqx_bridge_gcp_pubsub,
|
||||||
emqx_ee_bridge_influxdb,
|
emqx_ee_bridge_influxdb,
|
||||||
|
@ -54,7 +55,6 @@ schema_modules() ->
|
||||||
emqx_ee_bridge_clickhouse,
|
emqx_ee_bridge_clickhouse,
|
||||||
emqx_ee_bridge_dynamo,
|
emqx_ee_bridge_dynamo,
|
||||||
emqx_ee_bridge_rocketmq,
|
emqx_ee_bridge_rocketmq,
|
||||||
emqx_ee_bridge_cassa,
|
|
||||||
emqx_ee_bridge_sqlserver
|
emqx_ee_bridge_sqlserver
|
||||||
].
|
].
|
||||||
|
|
||||||
|
@ -75,6 +75,7 @@ resource_type(kafka_consumer) -> emqx_bridge_kafka_impl_consumer;
|
||||||
%% 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.
|
||||||
resource_type(kafka) -> emqx_bridge_kafka_impl_producer;
|
resource_type(kafka) -> emqx_bridge_kafka_impl_producer;
|
||||||
|
resource_type(cassandra) -> emqx_bridge_cassandra_impl;
|
||||||
resource_type(hstreamdb) -> emqx_ee_connector_hstreamdb;
|
resource_type(hstreamdb) -> emqx_ee_connector_hstreamdb;
|
||||||
resource_type(gcp_pubsub) -> emqx_bridge_gcp_pubsub_connector;
|
resource_type(gcp_pubsub) -> emqx_bridge_gcp_pubsub_connector;
|
||||||
resource_type(mongodb_rs) -> emqx_ee_connector_mongodb;
|
resource_type(mongodb_rs) -> emqx_ee_connector_mongodb;
|
||||||
|
@ -93,7 +94,6 @@ resource_type(tdengine) -> emqx_ee_connector_tdengine;
|
||||||
resource_type(clickhouse) -> emqx_ee_connector_clickhouse;
|
resource_type(clickhouse) -> emqx_ee_connector_clickhouse;
|
||||||
resource_type(dynamo) -> emqx_ee_connector_dynamo;
|
resource_type(dynamo) -> emqx_ee_connector_dynamo;
|
||||||
resource_type(rocketmq) -> emqx_ee_connector_rocketmq;
|
resource_type(rocketmq) -> emqx_ee_connector_rocketmq;
|
||||||
resource_type(cassandra) -> emqx_ee_connector_cassa;
|
|
||||||
resource_type(sqlserver) -> emqx_ee_connector_sqlserver.
|
resource_type(sqlserver) -> emqx_ee_connector_sqlserver.
|
||||||
|
|
||||||
fields(bridges) ->
|
fields(bridges) ->
|
||||||
|
@ -148,7 +148,7 @@ fields(bridges) ->
|
||||||
)},
|
)},
|
||||||
{cassandra,
|
{cassandra,
|
||||||
mk(
|
mk(
|
||||||
hoconsc:map(name, ref(emqx_ee_bridge_cassa, "config")),
|
hoconsc:map(name, ref(emqx_bridge_cassandra, "config")),
|
||||||
#{
|
#{
|
||||||
desc => <<"Cassandra Bridge Config">>,
|
desc => <<"Cassandra Bridge Config">>,
|
||||||
required => false
|
required => false
|
||||||
|
|
|
@ -1,5 +1,4 @@
|
||||||
toxiproxy
|
toxiproxy
|
||||||
influxdb
|
influxdb
|
||||||
clickhouse
|
clickhouse
|
||||||
cassandra
|
|
||||||
sqlserver
|
sqlserver
|
||||||
|
|
|
@ -12,7 +12,6 @@
|
||||||
clickhouse,
|
clickhouse,
|
||||||
erlcloud,
|
erlcloud,
|
||||||
rocketmq,
|
rocketmq,
|
||||||
ecql,
|
|
||||||
odbc
|
odbc
|
||||||
]},
|
]},
|
||||||
{env, []},
|
{env, []},
|
||||||
|
|
13
mix.exs
13
mix.exs
|
@ -156,6 +156,19 @@ defmodule EMQXUmbrella.MixProject do
|
||||||
MapSet.new([
|
MapSet.new([
|
||||||
:emqx_bridge_kafka,
|
:emqx_bridge_kafka,
|
||||||
:emqx_bridge_gcp_pubsub
|
:emqx_bridge_gcp_pubsub
|
||||||
|
:emqx_bridge_cassandra,
|
||||||
|
:emqx_bridge_clickhouse,
|
||||||
|
:emqx_bridge_dynamo,
|
||||||
|
:emqx_bridge_hstreamdb,
|
||||||
|
:emqx_bridge_influxdb,
|
||||||
|
:emqx_bridge_matrix,
|
||||||
|
:emqx_bridge_mongodb,
|
||||||
|
:emqx_bridge_mysql,
|
||||||
|
:emqx_bridge_pgsql,
|
||||||
|
:emqx_bridge_redis,
|
||||||
|
:emqx_bridge_rocketmq,
|
||||||
|
:emqx_bridge_tdengine,
|
||||||
|
:emqx_bridge_timescale
|
||||||
])
|
])
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -80,6 +80,19 @@ is_enterprise(ee) -> true.
|
||||||
|
|
||||||
is_community_umbrella_app("apps/emqx_bridge_kafka") -> false;
|
is_community_umbrella_app("apps/emqx_bridge_kafka") -> false;
|
||||||
is_community_umbrella_app("apps/emqx_bridge_gcp_pubsub") -> false;
|
is_community_umbrella_app("apps/emqx_bridge_gcp_pubsub") -> false;
|
||||||
|
is_community_umbrella_app("apps/emqx_bridge_cassandra") -> false;
|
||||||
|
is_community_umbrella_app("apps/emqx_bridge_clickhouse") -> false;
|
||||||
|
is_community_umbrella_app("apps/emqx_bridge_dynamo") -> false;
|
||||||
|
is_community_umbrella_app("apps/emqx_bridge_hstreamdb") -> false;
|
||||||
|
is_community_umbrella_app("apps/emqx_bridge_influxdb") -> false;
|
||||||
|
is_community_umbrella_app("apps/emqx_bridge_matrix") -> false;
|
||||||
|
is_community_umbrella_app("apps/emqx_bridge_mongodb") -> false;
|
||||||
|
is_community_umbrella_app("apps/emqx_bridge_mysql") -> false;
|
||||||
|
is_community_umbrella_app("apps/emqx_bridge_pgsql") -> false;
|
||||||
|
is_community_umbrella_app("apps/emqx_bridge_redis") -> false;
|
||||||
|
is_community_umbrella_app("apps/emqx_bridge_rocketmq") -> false;
|
||||||
|
is_community_umbrella_app("apps/emqx_bridge_tdengine") -> false;
|
||||||
|
is_community_umbrella_app("apps/emqx_bridge_timescale") -> false;
|
||||||
is_community_umbrella_app(_) -> true.
|
is_community_umbrella_app(_) -> true.
|
||||||
|
|
||||||
is_jq_supported() ->
|
is_jq_supported() ->
|
||||||
|
@ -441,6 +454,19 @@ relx_apps_per_edition(ee) ->
|
||||||
emqx_ee_bridge,
|
emqx_ee_bridge,
|
||||||
emqx_bridge_kafka,
|
emqx_bridge_kafka,
|
||||||
emqx_bridge_gcp_pubsub,
|
emqx_bridge_gcp_pubsub,
|
||||||
|
emqx_bridge_cassandra,
|
||||||
|
emqx_bridge_clickhouse,
|
||||||
|
emqx_bridge_dynamo,
|
||||||
|
emqx_bridge_hstreamdb,
|
||||||
|
emqx_bridge_influxdb,
|
||||||
|
emqx_bridge_matrix,
|
||||||
|
emqx_bridge_mongodb,
|
||||||
|
emqx_bridge_mysql,
|
||||||
|
emqx_bridge_pgsql,
|
||||||
|
emqx_bridge_redis,
|
||||||
|
emqx_bridge_rocketmq,
|
||||||
|
emqx_bridge_tdengine,
|
||||||
|
emqx_bridge_timescale,
|
||||||
emqx_ee_schema_registry
|
emqx_ee_schema_registry
|
||||||
];
|
];
|
||||||
relx_apps_per_edition(ce) ->
|
relx_apps_per_edition(ce) ->
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
emqx_ee_bridge_cassa {
|
emqx_bridge_cassandra {
|
||||||
|
|
||||||
config_enable.desc:
|
config_enable.desc:
|
||||||
"""Enable or disable this bridge"""
|
"""Enable or disable this bridge"""
|
|
@ -1,4 +1,4 @@
|
||||||
emqx_ee_connector_cassa {
|
emqx_bridge_cassa_impl {
|
||||||
|
|
||||||
keyspace.desc:
|
keyspace.desc:
|
||||||
"""Keyspace name to connect to."""
|
"""Keyspace name to connect to."""
|
|
@ -112,6 +112,48 @@ case "${WHICH_APP}" in
|
||||||
## ensure enterprise profile when testing ee applications
|
## ensure enterprise profile when testing ee applications
|
||||||
export PROFILE='emqx-enterprise'
|
export PROFILE='emqx-enterprise'
|
||||||
;;
|
;;
|
||||||
|
apps/emqx_bridge_cassandra)
|
||||||
|
export PROFILE='emqx-enterprise'
|
||||||
|
;;
|
||||||
|
apps/emqx_bridge_clickhouse)
|
||||||
|
export PROFILE='emqx-enterprise'
|
||||||
|
;;
|
||||||
|
apps/emqx_bridge_dynamo)
|
||||||
|
export PROFILE='emqx-enterprise'
|
||||||
|
;;
|
||||||
|
apps/emqx_bridge_gcp_pubsub)
|
||||||
|
export PROFILE='emqx-enterprise'
|
||||||
|
;;
|
||||||
|
apps/emqx_bridge_hstreamdb)
|
||||||
|
export PROFILE='emqx-enterprise'
|
||||||
|
;;
|
||||||
|
apps/emqx_bridge_influxdb)
|
||||||
|
export PROFILE='emqx-enterprise'
|
||||||
|
;;
|
||||||
|
apps/emqx_bridge_matrix)
|
||||||
|
export PROFILE='emqx-enterprise'
|
||||||
|
;;
|
||||||
|
apps/emqx_bridge_mongodb)
|
||||||
|
export PROFILE='emqx-enterprise'
|
||||||
|
;;
|
||||||
|
apps/emqx_bridge_mysql)
|
||||||
|
export PROFILE='emqx-enterprise'
|
||||||
|
;;
|
||||||
|
apps/emqx_bridge_pgsql)
|
||||||
|
export PROFILE='emqx-enterprise'
|
||||||
|
;;
|
||||||
|
apps/emqx_bridge_redis)
|
||||||
|
export PROFILE='emqx-enterprise'
|
||||||
|
;;
|
||||||
|
apps/emqx_bridge_rocketmq)
|
||||||
|
export PROFILE='emqx-enterprise'
|
||||||
|
;;
|
||||||
|
apps/emqx_bridge_tdengine)
|
||||||
|
export PROFILE='emqx-enterprise'
|
||||||
|
;;
|
||||||
|
apps/emqx_bridge_timescale)
|
||||||
|
export PROFILE='emqx-enterprise'
|
||||||
|
;;
|
||||||
*)
|
*)
|
||||||
export PROFILE="${PROFILE:-emqx}"
|
export PROFILE="${PROFILE:-emqx}"
|
||||||
;;
|
;;
|
||||||
|
|
Loading…
Reference in New Issue