Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[mosquitto-dev] Order of "topic" rules in bridge definitions

Hi,

I'm doing some experiments with bridging.  When doing this, one question
remained unanswered from the documentation: how are multiple topic rules
in a bridge definition interpreted if their patterns are not mutually
exclusive?

What I have: 3 mosquitto servers, think of them as the left, middle
and right server, and the middle server is setting up a bridge to
both the left and right server.  I first tried this:

  connection leftbridge
  address 127.0.0.1:1883
  cleansession true
  topic # in 0 bridged/fromleft/ ""
  topic # out 0 "" bridged/frommiddle/

  connection rightbridge
  address 127.0.0.1:9883
  cleansession true
  topic # in 0 bridged/fromright/ ""
  topic # out 0 "" bridged/frommiddle/

This works, that is, all messages appear on all servers and are
prefixed by every bridge path they have passed.  So, left messages
in "tst" arrive at the right as "bridged/frommiddle/bridged/fromleft/tst".

Now I wanted to avoid the double prefixes and, after some attempts, I
ended up with this config:

  connection leftbridge
  address 127.0.0.1:1883
  cleansession true
  topic # in 0 bridged/fromleft/ ""
  topic # out 0 bridged/fromright/ bridged/fromright/
  topic # out 0 "" bridged/frommiddle/

  connection rightbridge
  address 127.0.0.1:9883
  cleansession true
  topic # in 0 bridged/fromright/ ""
  topic # out 0 bridged/fromleft/ bridged/fromleft/
  topic # out 0 "" bridged/frommiddle/

Now this seems to work, but as soon as I exchange the "out" rules in
each bridge, I see the old behavior, so the order does matter.

My question is: can I rely on the matching order for topics (the
first match determines the policy) and in this way safely list
exceptions *before* the generic "" rule?

Thx,

--
--    Jos Vos <jos@xxxxxx>
--    X/OS Experts in Open Systems BV   |   Phone: +31 20 6938364
--    Amsterdam, The Netherlands        |     Fax: +31 20 6948204


Back to the top