Skip to content

Hierarchical Topics

Topics within Neuron can be expressed through hierarchies, either by defining two or more levels for the Topic (sub Topics). For example, a Topic could be named something as simple as “Receivables”. Publishers could submit messages to that topic, and subscribers would receive messages if they were interested in “Receivables”.   But what if there were “Receivables” from multiple departments within the business and subscribers wanted to only receive messages from one, and not the other? To solve that problem hierarchical topics could be employed, providing subscribers more granular subscription options.

For instance, “Receivables” could instead be defined using the following hierarchy:

 “Contoso.NorthAmerica.Finance.Receivables”.  

Following this pattern, we could then define another “Receivables”  topic like so:

“Contoso.Europe.Finance.Receivables”.  

 Using this example, Subscribers would have the option to subscriber to either one or both.  Using hierarchies also allows Susbcribers to define their subscriptions using a wildcard character, in the event that they are interested in all messages below a specific level in the hierarchy.  For example, there may be two topics named:

“Contoso.NorthAmerica.Finance.Receivables”.  
“Contoso.NorthAmerica.Finance.Payables”.  

As a subscriber, I may want to subscribe to everything that is published to “Contoso.NorthAmerica.Finance” or to any existing or future sub levels like “Receivables” and “Payables”. In this case a subscriber can configure their subscription in the following manner using the “*” as a wild card character:

“Contoso.NorthAmerica.Finance.*”
Development - Hierarchical Topics Fig.1
Figure 1: Topic based publish and subscribe– Shows message being published to hierarchical topic and delivered only to recipients who have a valid subscription.

In most cases it is more beneficial to create a Topic Taxonomy consisting of a hierarchy that either more closely aligns to the business requirements of a project, or perhaps follows the organizational structure of the business.  In either case, Topic based publish and subscribe systems are generally more intuitive and easy to use/configure than other types of messaging patterns.

Was this article helpful?
Dislike 0
Previous: Topic Based Publish and Subscribe
Next: Publish and Subscribe Variations