Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [mosquitto-dev] Storing all Messages in Database - Avoiding Single Subscriber `#` Anti-pattern

Drasko DRASKOVIC <drasko.draskovic@xxxxxxxxx> wrote:
> On Tue, Sep 6, 2016 at 1:10 PM, Drasko DRASKOVIC
> <drasko.draskovic@xxxxxxxxx> wrote:
> > Hello,
> > in relation to this:
> > https://groups.google.com/forum/#!topic/rabbitmq-users/KVMNkAsW-ac, I
> > would like to understand if there is a way to take all the message
> > data from all Mosquitto nodes in a bridged cluster and store them into
> > database without passing via subscription to `#` topic which would
> > cause that all messages are routed through one "hot" node - which
> > defeats purpose of clustering.
> 
> It is strange though that in the official examples I find
> exactly the Single Subscriber anti-pattern:
> https://github.com/eclipse/mosquitto/blob/master/examples/mysql_log/mysql_log.c,
> line:

Says who? Who says it's an antipattern? You want to save all the
messages in some "other" way, but you don't want to get all the
messages via even a local networking connecton (which are pretty
heavily optimized in most OSs)

If your bridging configuration results in you creating hotspots,
that's a problem with how you're setting up your bridging and
clustering, not that you need some "special" way of writing out
files that's not called subscribing.

What _is_ an antipattern is publishing all your data into a flat
topic called "data" or something, and then being _required_ to
subscribe to a very broad topic even if you're only interested in
a subset of it.

If you really _do_ want to listen to all the data, subscribing to
"#" is _precisely_ the way to do so.

Sincerely,
Karl P

Attachment: signature.asc
Description: OpenPGP Digital Signature


Back to the top