chore: add desc for rabbitmq source
This commit is contained in:
parent
b444c82a42
commit
688701eedb
|
@ -78,7 +78,7 @@ fields("config") ->
|
|||
{local_topic,
|
||||
mk(
|
||||
binary(),
|
||||
#{desc => ?DESC("local_topic"), default => undefined}
|
||||
#{desc => ?DESC("local_topic")}
|
||||
)},
|
||||
{resource_opts,
|
||||
mk(
|
||||
|
|
|
@ -3,7 +3,8 @@
|
|||
%%--------------------------------------------------------------------
|
||||
|
||||
-module(emqx_bridge_rabbitmq_connector).
|
||||
%-feature(maybe_expr, enable).
|
||||
|
||||
-feature(maybe_expr, enable).
|
||||
-include_lib("emqx_connector/include/emqx_connector.hrl").
|
||||
-include_lib("emqx_resource/include/emqx_resource.hrl").
|
||||
-include_lib("typerefl/include/types.hrl").
|
||||
|
|
|
@ -106,6 +106,8 @@ fields("get") ->
|
|||
|
||||
desc("config_connector") ->
|
||||
?DESC("config_connector");
|
||||
desc(connector_resource_opts) ->
|
||||
?DESC(connector_resource_opts);
|
||||
desc(_) ->
|
||||
undefined.
|
||||
|
||||
|
|
|
@ -27,6 +27,7 @@
|
|||
|
||||
-define(ACTION_TYPE, rabbitmq).
|
||||
-define(SOURCE_TYPE, rabbitmq).
|
||||
-define(CONNECTOR_SCHEMA, emqx_bridge_rabbitmq_connector_schema).
|
||||
|
||||
%%======================================================================================
|
||||
%% Hocon Schema Definitions
|
||||
|
@ -61,7 +62,7 @@ fields(action_parameters) ->
|
|||
boolean(),
|
||||
#{
|
||||
default => true,
|
||||
desc => ?DESC("wait_for_publish_confirmations")
|
||||
desc => ?DESC(?CONNECTOR_SCHEMA, "wait_for_publish_confirmations")
|
||||
}
|
||||
)},
|
||||
{publish_confirmation_timeout,
|
||||
|
@ -69,7 +70,7 @@ fields(action_parameters) ->
|
|||
emqx_schema:timeout_duration_ms(),
|
||||
#{
|
||||
default => <<"30s">>,
|
||||
desc => ?DESC("timeout")
|
||||
desc => ?DESC(?CONNECTOR_SCHEMA, "timeout")
|
||||
}
|
||||
)},
|
||||
{exchange,
|
||||
|
@ -77,7 +78,7 @@ fields(action_parameters) ->
|
|||
typerefl:binary(),
|
||||
#{
|
||||
required => true,
|
||||
desc => ?DESC("exchange")
|
||||
desc => ?DESC(?CONNECTOR_SCHEMA, "exchange")
|
||||
}
|
||||
)},
|
||||
{routing_key,
|
||||
|
@ -85,7 +86,7 @@ fields(action_parameters) ->
|
|||
typerefl:binary(),
|
||||
#{
|
||||
required => true,
|
||||
desc => ?DESC("routing_key")
|
||||
desc => ?DESC(?CONNECTOR_SCHEMA, "routing_key")
|
||||
}
|
||||
)},
|
||||
{delivery_mode,
|
||||
|
@ -93,15 +94,14 @@ fields(action_parameters) ->
|
|||
hoconsc:enum([non_persistent, persistent]),
|
||||
#{
|
||||
default => non_persistent,
|
||||
desc => ?DESC("delivery_mode")
|
||||
desc => ?DESC(?CONNECTOR_SCHEMA, "delivery_mode")
|
||||
}
|
||||
)},
|
||||
{payload_template,
|
||||
hoconsc:mk(
|
||||
binary(),
|
||||
#{
|
||||
default => <<"${.}">>,
|
||||
desc => ?DESC("payload_template")
|
||||
desc => ?DESC(?CONNECTOR_SCHEMA, "payload_template")
|
||||
}
|
||||
)}
|
||||
];
|
||||
|
@ -117,21 +117,21 @@ fields(source) ->
|
|||
fields(subscriber_source) ->
|
||||
emqx_bridge_v2_schema:make_consumer_action_schema(
|
||||
?HOCON(
|
||||
?R_REF(ingress_parameters),
|
||||
?R_REF(source_parameters),
|
||||
#{
|
||||
required => true,
|
||||
desc => ?DESC("source_parameters")
|
||||
}
|
||||
)
|
||||
);
|
||||
fields(ingress_parameters) ->
|
||||
fields(source_parameters) ->
|
||||
[
|
||||
{wait_for_publish_confirmations,
|
||||
hoconsc:mk(
|
||||
boolean(),
|
||||
#{
|
||||
default => true,
|
||||
desc => ?DESC("wait_for_publish_confirmations")
|
||||
desc => ?DESC(?CONNECTOR_SCHEMA, "wait_for_publish_confirmations")
|
||||
}
|
||||
)},
|
||||
{topic,
|
||||
|
@ -140,7 +140,7 @@ fields(ingress_parameters) ->
|
|||
#{
|
||||
required => true,
|
||||
validator => fun emqx_schema:non_empty_string/1,
|
||||
desc => ?DESC("ingress_topic")
|
||||
desc => ?DESC("source_topic")
|
||||
}
|
||||
)},
|
||||
{qos,
|
||||
|
@ -148,7 +148,7 @@ fields(ingress_parameters) ->
|
|||
?UNION([emqx_schema:qos(), binary()]),
|
||||
#{
|
||||
default => 0,
|
||||
desc => ?DESC("ingress_qos")
|
||||
desc => ?DESC("source_qos")
|
||||
}
|
||||
)},
|
||||
{payload_template,
|
||||
|
@ -156,7 +156,7 @@ fields(ingress_parameters) ->
|
|||
binary(),
|
||||
#{
|
||||
required => false,
|
||||
desc => ?DESC("ingress_payload_template")
|
||||
desc => ?DESC("source_payload_template")
|
||||
}
|
||||
)},
|
||||
{queue,
|
||||
|
@ -164,7 +164,7 @@ fields(ingress_parameters) ->
|
|||
binary(),
|
||||
#{
|
||||
required => true,
|
||||
desc => ?DESC("ingress_queue")
|
||||
desc => ?DESC("source_queue")
|
||||
}
|
||||
)},
|
||||
{no_ack,
|
||||
|
@ -173,7 +173,7 @@ fields(ingress_parameters) ->
|
|||
#{
|
||||
required => false,
|
||||
default => true,
|
||||
desc => ?DESC("ingress_no_ack")
|
||||
desc => ?DESC("source_no_ack")
|
||||
}
|
||||
)}
|
||||
];
|
||||
|
@ -210,8 +210,8 @@ desc(source_resource_opts) ->
|
|||
?DESC(emqx_resource_schema, "creation_opts");
|
||||
desc(action_parameters) ->
|
||||
?DESC(action_parameters);
|
||||
desc(ingress_parameters) ->
|
||||
?DESC(ingress_parameters);
|
||||
desc(source_parameters) ->
|
||||
?DESC(source_parameters);
|
||||
desc(Method) when Method =:= "get"; Method =:= "put"; Method =:= "post" ->
|
||||
["Configuration for WebHook using `", string:to_upper(Method), "` method."];
|
||||
desc("http_action") ->
|
||||
|
|
|
@ -15,6 +15,7 @@
|
|||
%%--------------------------------------------------------------------
|
||||
-module(emqx_bridge_rabbitmq_sup).
|
||||
|
||||
-feature(maybe_expr, enable).
|
||||
-behaviour(supervisor).
|
||||
|
||||
-export([ensure_started/2]).
|
||||
|
|
|
@ -731,17 +731,17 @@ schema_homogeneous_test() ->
|
|||
is_bad_schema(#{type := ?MAP(_, ?R_REF(Module, TypeName))}) ->
|
||||
Fields = Module:fields(TypeName),
|
||||
ExpectedFieldNames = common_field_names(),
|
||||
MissingFileds = lists:filter(
|
||||
MissingFields = lists:filter(
|
||||
fun(Name) -> lists:keyfind(Name, 1, Fields) =:= false end, ExpectedFieldNames
|
||||
),
|
||||
case MissingFileds of
|
||||
case MissingFields of
|
||||
[] ->
|
||||
false;
|
||||
_ ->
|
||||
{true, #{
|
||||
schema_module => Module,
|
||||
type_name => TypeName,
|
||||
missing_fields => MissingFileds
|
||||
missing_fields => MissingFields
|
||||
}}
|
||||
end.
|
||||
|
||||
|
|
|
@ -14,7 +14,6 @@
|
|||
warn_unused_import,
|
||||
warn_obsolete_guard,
|
||||
compressed,
|
||||
{feature, maybe_expr, enable},
|
||||
nowarn_unused_import,
|
||||
{d, snk_kind, msg}
|
||||
]}.
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
|
||||
emqx_bridge_rabbitmq_connector {
|
||||
emqx_bridge_rabbitmq_connector_schema {
|
||||
|
||||
server.desc:
|
||||
"""The RabbitMQ server address that you want to connect to (for example, localhost)."""
|
||||
|
@ -97,4 +97,15 @@ wait_for_publish_confirmations.desc:
|
|||
wait_for_publish_confirmations.label:
|
||||
"""Wait for Publish Confirmations"""
|
||||
|
||||
connector_resource_opts.desc:
|
||||
"""Connector resource options."""
|
||||
|
||||
connector_resource_opts.label:
|
||||
"""Connector Resource Options"""
|
||||
|
||||
config_connector.desc:
|
||||
"""The configuration for the RabbitMQ connector."""
|
||||
config_connector.label:
|
||||
"""RabbitMQ Connector Configuration"""
|
||||
|
||||
}
|
|
@ -0,0 +1,49 @@
|
|||
emqx_bridge_rabbitmq_pubsub_schema {
|
||||
|
||||
publisher_action.desc:
|
||||
"""Action configs."""
|
||||
publisher_action.label:
|
||||
"""Action"""
|
||||
|
||||
subscriber_source.desc:
|
||||
"""Source configs."""
|
||||
subscriber_source.label:
|
||||
"""Source"""
|
||||
|
||||
|
||||
action_parameters.desc:
|
||||
"""The action config defines how this bridge send messages to the remote RabbitMQ broker"""
|
||||
action_parameters.label:
|
||||
"""Action Parameters"""
|
||||
|
||||
source_parameters.desc:
|
||||
"""The source config defines how this bridge receive messages from the remote RabbitMQ broker"""
|
||||
source_parameters.label:
|
||||
"""Source Parameters"""
|
||||
|
||||
source_topic.desc:
|
||||
"""Topic used for constructing MQTT messages, supporting templates."""
|
||||
source_topic.label:
|
||||
"""Source Topic"""
|
||||
|
||||
source_qos.desc:
|
||||
"""The QoS level of the MQTT message, supporting templates."""
|
||||
source_qos.label:
|
||||
"""QoS"""
|
||||
|
||||
source_payload_template.desc:
|
||||
"""The template used to construct the payload of the MQTT message."""
|
||||
source_payload_template.label:
|
||||
"""Source Payload Template"""
|
||||
|
||||
source_queue.desc:
|
||||
"""The queue name of the RabbitMQ broker."""
|
||||
source_queue.label:
|
||||
"""Source Queue"""
|
||||
|
||||
source_no_ack.desc:
|
||||
"""Whether to use no_ack mode when consuming messages from the RabbitMQ broker."""
|
||||
source_no_ack.label:
|
||||
"""Source No Ack"""
|
||||
|
||||
}
|
Loading…
Reference in New Issue