Multiple channel interceptors#16046
Conversation
using different configured priority levels. Only disallow channel interceptors for the same AMQP operation when they have the same configured priority level.
channel interceptors with their configured meta information
|
@Ayanda-D thanks but for the umpteenth time, the core team suggests that you start a discussion first to gauge the interest in a certain change instead of showing up straight with a PR. |
Sorry but I'm a little bit less enthusiastic about the impact of this change. This is a lot of complexity for a change that 99% of RabbitMQ users will not need, and it was not previously discussed. |
|
@michaelklishin sorry for not starting off with discussion - the change seemed straightforward and not too complex, as it's mainly altering the restriction |
rabbit/src with behaviour dependencies
f4ce0f1 to
0c389dc
Compare
Proposed Changes
Hi folks 👋
The following changes seek to add support for multiple channel interceptors within the broker. Currently, when developing channel interceptor type plugins, development is restricted to single interceptor per AMQP operation, per installation. When use-cases grow and need for multiple interceptors for the same AMQP operation arises, this becomes a problem (and combining multiple use-cases within the same channel interceptor module makes things even more complex).
In these changes, we propose supporting multiple channel interceptors for the same AMQP operation, based on configurable priority. Interceptors with the same priority level for the same AMQP operation will not be allowed, as per current behaviour in channels. For example, if 3 interceptors need to intercept
queue.declare, these would be configured as following in rabbitmq.conf:These are executed in priority order (starting with the lowest) in the channel. If 2 interceptors for same AMQP operation have the same priority level, registry will fails as current RabbitMQ channel interceptor behaviour. The following wouldnt work if both intercept the same AMQP operation (also priorities default to
0if not configured, same restriction applies if multiple interceptors are enabled without any config in rabbitmq.conf):In addition, these changes also introduce a new
rabbitmqctl list_channel_interceptorscommand to get visibility on active interceptors (as number of interceptors grow, we'll need this to keep track of whats active and execution order from the priority levels)NOTE: I've moved
dummy_interceptormodule fromrabbit/test/torabbit/src/to make available for the cli (elixir) tests - we could optionally keep it in the test DIR and do dynamic code loading over RPC of compiled beam/object code - but it feels like too much complexity for running simple cli tests. Placing inrabbit/src/much simpler.Please take a look, we are currently stuck and restricted on only having a single channel-interceptors, whilst uses-cases grow. This change would significantly help and improve extensibility of the broker for plugin developers (and also mean less need to propose changes to the broker core, which is always the goal 😇) - we'd appreciate this a lot. Thanks!
Types of Changes
What types of changes does your code introduce to this project?
Put an
xin the boxes that applyChecklist
Put an
xin the boxes that apply.You can also fill these out after creating the PR.
This is simply a reminder of what we are going to look for before merging your code.
CONTRIBUTING.mddocument