Message routing and topics, thought shift

Click for: original source

A lot has changed - Memory, Storage, and CPU are cheaper and available on demand. Cloud technologies have also disrupted this domain; we now have Infrastructure as a Service (IaaS) - Scaling, Load Balancing, and DR responsibilities have been delegated to the Cloud service providers. By Giri Venkatesan.

In an ideal world, a messaging broker would never need to open the payload - it can be simply passing messages between producers and consumers based on subscription. Not all consumers are equal; they may be built to handle subsets of messages even if they are of the same class. For example, a Tax Calculation service would need to process the message differently based on the country or region the message is originating from.

Fortunately, MQTT-based brokers adopted the hierarchical representation of topics from the get-go.

Message hierarchical taxonomy

Source: https://www.linkedin.com/pulse/message-routing-topics-thought-shift-giri-venkatesan/

The benefits of such a hierarchical scheme don’t stop there. Now we can use wild cards at any level to capture a broader range of message topics in a subscription:

  • Single-level wildcard: ‘*’
    • All credit card transactions from store 1049, with transaction number beginning ‘4’
    • quickpay/credit/*/4*/01049
  • Multi-level wildcard: ‘>’
    • All debit transaction to be cleared at bank 18
    • quickpay/debit/0018/>
    • Literals at each level are treated as Strings - hence wildcard usage on data types like latitude/longitude coordinates and other custom identifiers would also benefit
    • bustrak/gps_updt/*/*/45.3*/-75.7*

With support for versioning, topics can be altered dynamically without affecting the existing subscribers and overall architecture. Good read!

[Read More]

Tags cio app-development messaging devops event-driven