Skip to content

Support interceptors for native protocols #10051

@ansd

Description

@ansd

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 (e.g. Sharding Plugin) that intercept or 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

The solution hasn't been fully designed yet, but here are some suggestions:

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).

For AMQP 1.0, the AMQP 0.9.1 channel interceptor equivalent would be an AMQP 1.0 session interceptor.
We should also come up with a design that allows existing plugins currently targeting AMQP 0.9.1 (for example the Sharding Plugin) to be used with AMQP 1.0. Hence, it might make sense to allow hooks in rabbit_amqp_management before/after creating/updating/deleting exchanges, queues, and bindings.

So sum up, the solution should be a holistic in the sense that it:

  • provides similar functionalities for Native AMQP 1.0, Native MQTT, AMQP 0.9.1
  • works with existing plugins (e.g. the Sharding plugin)
  • works with future extensions, potentially with message container hook Support custom message container hook #10050

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.)

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions