Skip to content

Commit 11a14e5

Browse files
committed
Put proto value in interceptor ctx map
1 parent 27621c5 commit 11a14e5

File tree

4 files changed

+10
-5
lines changed

4 files changed

+10
-5
lines changed

deps/rabbit/src/rabbit_amqp_session.erl

+2-1
Original file line numberDiff line numberDiff line change
@@ -476,7 +476,8 @@ init({ReaderPid, WriterPid, ChannelNum, MaxFrameSize, User, Vhost, ContainerId,
476476
max_incoming_window = MaxIncomingWindow,
477477
max_link_credit = MaxLinkCredit,
478478
max_queue_credit = MaxQueueCredit,
479-
msg_interceptor_ctx = #{username => User#user.username,
479+
msg_interceptor_ctx = #{protocol => amqp,
480+
username => User#user.username,
480481
vhost => Vhost,
481482
conn_name => ConnName}
482483
}}}.

deps/rabbit/src/rabbit_channel.erl

+2-1
Original file line numberDiff line numberDiff line change
@@ -511,7 +511,8 @@ init([Channel, ReaderPid, WriterPid, ConnPid, ConnName, Protocol, User, VHost,
511511
authz_context = OptionalVariables,
512512
max_consumers = MaxConsumers,
513513
writer_gc_threshold = GCThreshold,
514-
msg_interceptor_ctx = #{username => User#user.username,
514+
msg_interceptor_ctx = #{protocol => amqp091,
515+
username => User#user.username,
515516
vhost => VHost,
516517
conn_name => ConnName}
517518
},

deps/rabbit/src/rabbit_message_interceptor.erl

+2-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,8 @@
33
-export([intercept/3,
44
set_msg_annotation/4]).
55

6-
-type protocol() :: amqp091 | amqp | mqttv3 | mqttv5.
6+
-type protocol() :: amqp091 | amqp | mqtt310 | mqtt311 | mqtt50.
7+
78
-type msg_interceptor_ctx() :: #{protocol := protocol(),
89
vhost := binary(),
910
username := binary(),

deps/rabbitmq_mqtt/src/rabbit_mqtt_processor.erl

+4-2
Original file line numberDiff line numberDiff line change
@@ -215,9 +215,10 @@ process_connect(
215215
%% To simplify logic, we decide at connection establishment time to stick
216216
%% with either binding args v1 or v2 for the lifetime of the connection.
217217
BindingArgsV2 = rabbit_feature_flags:is_enabled('rabbitmq_4.1.0'),
218+
AtomProtoVer = proto_integer_to_atom(ProtoVer),
218219
S = #state{
219220
cfg = #cfg{socket = Socket,
220-
proto_ver = proto_integer_to_atom(ProtoVer),
221+
proto_ver = AtomProtoVer,
221222
clean_start = CleanStart,
222223
session_expiry_interval_secs = SessionExpiry,
223224
ssl_login_name = SslLoginName,
@@ -239,7 +240,8 @@ process_connect(
239240
max_packet_size_outbound = MaxPacketSize,
240241
topic_alias_maximum_outbound = TopicAliasMaxOutbound,
241242
binding_args_v2 = BindingArgsV2,
242-
msg_interceptor_ctx = #{user => Username,
243+
msg_interceptor_ctx = #{protocol => AtomProtoVer,
244+
username => Username,
243245
vhost => VHost,
244246
conn_name => ConnName,
245247
client_id => ClientId}},

0 commit comments

Comments
 (0)