clojurewerkz / machine_head.docs

Machine Head documentation site

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

The Blabbr example with a wildcard doesn't make sense?

holyjak opened this issue · comments

I do not understand the Blabbr example with +:


(mh/subscribe conn
              ["nba/scores/+"]
              (fn [^String topic _ ^bytes payload]
                (println (format "[consumer] received a message on topic %s: %s" topic (String. payload "UTF-8"))))

+ in this example matches a single segment, for example

  • nba/scores/aaron
  • nba/scores/bob
  • nba/scores/joe

Publishing in this example is not really different from the previous example

(mh/publish conn topic "BOS 101, NYK 89")
(mh/publish conn topic "ORL 85, ALT 88")

From what I see, we publish to "nba/scores" and not to "nba/scores/(aaron|bob|joe)" so having one subscriber with a wildcard doesn't make sense? Or am I missing something?

This is just an example. Feel free to use more sensible topics/patterns.