main
..
rw-r--r--
901 B
rw-r--r--
379 B
rwxr-xr-x
595 B

Topic Exchanges

In this example we publish and subscribe to a topic exchange. Which gives us if more granularity with the type of messages we subscribe to.

Topic Exchanges allows us to specify routing keys in form of:

"canada.alberta.calgary"
"canada.alberta.*"
"canada.#"
  • * to substitute exactly one word.
  • to substitue zero or more words

To publish:

λ ruby lib/4-topic-exchange/publish.rb git.error 'just kidding'
 [x] Sent 'blah'
λ ruby lib/4-topic-exchange/publish.rb vim.warning 'too good'
 [x] Sent 'blah'

To subscribe:

λ ruby lib/5-topic-exchange/subscribe.rb vim.warning
 [*] Waiting for logs. To exit press CTRL+C
 [x] vim.warning:too good

or

λ ruby lib/5-topic-exchange/subscribe.rb git.#
 [*] Waiting for logs. To exit press CTRL+C
 [x] git.error:just kidding