heinz k
heinz k

Reputation: 1

Exclude a topic from wildcard topic on a mosquitto bridge

I have configured a bridge topic on a mosquitto broker with a wildcard like this:

topic sensor/# both 1

But I want to exclude a specific topic tree sensor/test/#. The sensor/test messages should be sent to any local subscriber but not over the bridge to the remote broker. How can I do that?

I've asked my colleague ChatGPT and it suggested topic - sensor/test/# both. But this delivers an error:

Invalid bridge topic direction 'sensor/test/#'.

Upvotes: 0

Views: 95

Answers (1)

hardillb
hardillb

Reputation: 59751

Assuming you just don't want to forward sensor/test/# to the remote end of the bridge then I think something like the following should work.

mosquitto.conf

...
acl_file acls.conf

connection remote-bridge
address remote.example.com
local_username localBridge
topic sensor/# both 1

acls.conf

user localBridge
topic read sensor/#
topic deny sensor/test/#

If you want to stop sensors/test/# from being sent from the remote broker, then this will require remote_username in the bridge and matching ACL rules on the remote broker.

Upvotes: 0

Related Questions