-
Notifications
You must be signed in to change notification settings - Fork 22
/
Copy pathon_deliver_hook.erl
37 lines (31 loc) · 1.32 KB
/
on_deliver_hook.erl
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
%% @hidden
-module(on_deliver_hook).
-include("vernemq_dev_int.hrl").
-callback on_deliver(UserName :: username(),
SubscriberId :: subscriber_id(),
QoS :: qos(),
Topic :: topic(),
Payload :: payload(),
IsRetain :: flag(),
Properties :: deliver_properties()) ->
ok
| {ok, Payload :: payload()}
| {ok, Modifiers :: [msg_modifier()]}
| next.
-type deliver_properties() ::
#{
p_payload_format_indicator => unspecified | utf8,
p_message_expiry_interval => seconds(),
p_topic_alias => 1..65535,
p_response_topic => topic(),
p_correlation_data => binary(),
p_user_property => nonempty_list(user_property()),
p_subscription_id => [subscription_id()],
p_content_type => utf8string()
}.
-type msg_modifier() ::
%% Rewrite the topic of the message.
{topic, topic()}
%% Rewrite the payload of the message.
| {payload, payload()}.
-export_type([msg_modifier/0]).