Skip to main content

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

Hi Jos,

if it's anything like when I "designed" this in RSMB, then the ordering should be significant, for two reasons:

1) it's simpler to implement
2) it provides predictable behaviour -- the first topic item in the list takes precedence

Not sophisticated, but it's meant for low footprint servers.

Ian

On 01/21/2015 11:56 AM, Jos Vos wrote:
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
_______________________________________________
mosquitto-dev mailing list
mosquitto-dev@xxxxxxxxxxx
To change your delivery options, retrieve your password, or unsubscribe from this list, visit
https://dev.eclipse.org/mailman/listinfo/mosquitto-dev

--
Ian Craggs
icraggs@xxxxxxxxxx                 IBM United Kingdom
Paho Project Lead; Committer on Mosquitto



Back to the top