rabbitmq-server
rabbitmq-server copied to clipboard
Support interceptors for native protocols
Is your feature request related to a problem? Please describe.
As described in https://github.com/rabbitmq/internals/blob/master/interceptors.md, rabbit_channel_interceptor
provides the ability to create 3rd party extensions that modify AMQP 0.9.1 methods.
Such an extension mechanism doesn't exist for native MQTT, native AMQP, or native STOMP.
Describe the solution you'd like
A 3rd party MQTT connection interceptor implementation will get as input the received MQTT packet and the MQTT processor state and outputs a modified MQTT packet (or forbids that packet).
The MQTT connection interceptor hook would be called earlier than the message container hook (see #10050), and for every MQTT packet type (not only for PUBLISH packets).
Describe alternatives you've considered
No response
Additional context
An example use case is described in https://groups.google.com/g/rabbitmq-users/c/gPJxxG2PGXM/m/EF2BDwpIAQAJ For this specific use case, the PUBLISH packet could be added User Property containing the MQTT client ID. Upon translation to AMQP 0.9.1 later on, these will be converted automatically into AMQP 0.9.1 headers. (This will only work for MQTT 5.0 though as lower MQTT versions don't have a User Property.)