How does Message filtering work in VerneMQ

Can you please provide me detail of how Message filtering works in VerneMQ.

Thank you for your help

2 Likes

Please define what you mean by “message filtering”.

Should you refer to how MQTT topics work please read the MQTT specification on v5 or v3.1.1

2 Likes

Hi afa

I read some it mention Message filtering has 3 level

OPTION 1: SUBJECT-BASED FILTERING
This filtering is based on the subject or topic that is part of each message.

I know this supported by VerneMQ

OPTION 2: CONTENT-BASED FILTERING
In content-based filtering, the broker filters the message based on a specific content filter-language. The receiving clients subscribe to filter queries of messages for which they are interested.

Does VerneMQ support Content-based filtering ?

OPTION 3: TYPE-BASED FILTERING
When object-oriented languages are used, filtering based on the type/class of a message (event) is a common practice. For example, a subscriber can listen to all messages, which are of type Exception or any sub-type.

Does VerneMQ support Content-based filtering ?

Thank you for your help

2 Likes

The MQTT specification does not support content-based filtering and type-based filtering, and therefore VerneMQ does not support those features.
Note that content-based filtering breaks the MQTT principle of never touching the payload (consider the payload encrypted anyway).

Also, what’s often done, is that the topic structure implements a message type structure. “Exception” is just a topic level, and subscribers can specifically filter (subscribe) for that level.

If you need content- or type-based filtering, you can always do this in a custom plugin.

2 Likes

I forgot to mention that with MQTT v5 you can use properties (like the “Content Type” property) to pass along additional information. The contract you create by that is between Publisher and Consumer, though. The broker will not handle messages differently based on “Content Type”.

2 Likes