DrmagicE / gmqtt

Gmqtt is a flexible, high-performance MQTT broker library that fully implements the MQTT protocol V3.x and V5 in golang
MIT License
989 stars 220 forks source link

bridging only specific topics #160

Closed slaesh closed 2 years ago

slaesh commented 2 years ago

if I understand the federation plugin correctly, I could (ab-)use it to "bridge" multiple brokers together?! :)

BUT, what if I want to "bridge" only specific topics.. mosquitto does it this way:

topic # both 2 local/topic/ remote/topic/

or only in one direction, maybe even only specific topics in one direction, others in both.. hope you get the point.. plenty of possible scenarios ;)

DrmagicE commented 2 years ago

@slaesh Hi, I think bridge and federation are two different things. Federation is more like clustering than bridging, which means that federation is intended to provide one logical MQTT broker to users while MQTT bridging exposes "bridge" concept to users and required additional configuration.

What the federation plugin actually does is to group multiple brokers in a kind of full-mesh network and usually require a load balancer in front of these brokers. That is to say that all nodes are identical from clients' perspective, clients should get the same behavior on different nodes.

So I think it may be a little weird to provide such capabilities in federation. Imagine there are two clients in the federation cluster. If configured to "bridge" only "/a/b/c" topics, then client A can receive messages from client B for other topics only if there are connecting to the same node, which means the nodes are not "identical" to clients anymore.

slaesh commented 2 years ago

good points! :) guessed that, that's why i used (ab-)use .. :) any plans to implement bridging itself?

DrmagicE commented 2 years ago

@slaesh sorry, cause I am not working on iot area now, so there are no plans for adding new features. One alternative is to write a plugin based on your requirements, I think that won't be too difficult. :)

slaesh commented 2 years ago

alright, thanks! :)