Hello EMQX Community,
I hope this message finds everyone well. I am currently working on a project involving EMQX, and I’ve encountered a specific requirement that I need some guidance on.
My project requires the implementation of a rate limit on the number of messages published to specific topics by each client. The key aspect of this requirement is that the rate limiting should apply exclusively to the publish messages, not including other types of messages like heartbeats or QoS messages.
I have explored the existing rate_limiting feature in EMQX, but it appears to encompass all types of messages, including heartbeat and QoS messages. This broader scope does not align with my project’s requirements, where I need a more targeted approach.
To be more specific, I am looking for a solution where:
-A rate limit can be set for publish messages on specific topics.
-Once a client exceeds this publish message limit, further messages should not be distributed to the subscribers and instead be dropped.
-The rate limit should not consider non-publish messages like heartbeats or QoS messages.
I am reaching out to ask if anyone in this community has faced a similar challenge or has insights into how this can be achieved in EMQX. Any guidance, whether it’s a direct solution, a workaround, or pointing towards relevant documentation, would be immensely helpful.
In addition to the above, I have also started exploring creating a custom plugin. Using the provided template, I’ve managed to set up a basic plugin and started working with the on_message_publish
hook. However, besides creating custom logs I have no idea how to prevent messages being routed to the subscribers. I’m able to change the topic of the message as a temporary solution. Also as far as I explored on_message_publish
hook doesn’t have client information. How can I have client information of the message to that hook? Thank you in advance for taking the time to read and respond to my query.