This commit is contained in:
anlicheng 2025-06-04 10:38:22 +08:00
parent 5fd69f0347
commit 6618ba5511
2 changed files with 64 additions and 0 deletions

View File

@ -0,0 +1,58 @@
%%%-------------------------------------------------------------------
%%% @author anlicheng
%%% @copyright (C) 2024, <COMPANY>
%%% @doc
%%% LineProtocol
%%% @end
%%% Created : 06. 5 2024 18:17
%%%-------------------------------------------------------------------
-author("anlicheng").
-record(http_endpoint, {
url = <<>> :: binary(),
pool_size = 10 :: integer()
}).
-record(mqtt_endpoint, {
host = <<>> :: binary(),
port = 0 :: integer(),
client_id = <<>> :: binary(),
username = <<>> :: binary(),
password = <<>> :: binary(),
topic = <<>> :: binary(),
qos = 0 :: integer()
}).
-record(kafka_endpoint, {
username = <<>> :: binary(),
password = <<>> :: binary(),
bootstrap_servers = [] :: [binary()],
topic = <<>> :: binary()
}).
-record(mysql_endpoint, {
host = <<>> :: binary(),
port = 0 :: integer(),
username = <<>> :: binary(),
password = <<>> :: binary(),
database = <<>> :: binary(),
table_name = <<>> :: binary(),
pool_size = 10 :: integer()
}).
-record(endpoint, {
id :: integer(),
%%
title = <<>> :: binary(),
mapper = <<>> :: binary(),
%%
%% fun(LocationCode :: binary(), Fields :: [{<<"key">> => <<>>, <<"value">> => <<>>, <<"unit">> => <<>>}])
%% fun(LocationCode :: binary(), Fields :: [{<<"key">> => <<>>, <<"value">> => <<>>, <<"unit">> => <<>>}], Timestamp :: integer())
mapper_fun = fun(_, Fields) -> Fields end :: fun(),
%% , : #{<<"protocol">> => <<"http|https|ws|kafka|mqtt">>, <<"args">> => #{}}
config = #http_endpoint{} :: #http_endpoint{} | #mqtt_endpoint{} | #kafka_endpoint{} | #mysql_endpoint{},
%%
updated_at = 0 :: integer(),
%%
created_at = 0 :: integer()
}).

View File

@ -5,7 +5,13 @@
{mod, {endpoint_app, []}}, {mod, {endpoint_app, []}},
{applications, {applications,
[ [
poolboy,
hackney,
sync,
mysql,
emqtt, emqtt,
parse_trans,
lager,
kernel, kernel,
stdlib stdlib
]}, ]},