Just a second...

Topic tree

Diffusion™ primarily distributes data using a pub-sub model, where content is published to topics. These topics are arranged as a tree.

What is the topic tree?

The topic tree is the organizational structure of the Diffusion topics. A topic of any type can be created any point in the topic tree where a topic does not already exist.

Locations in the topic tree are referred to by their topic path, which is the level names in the tree that lead to the topic, separated by the slash character (/).
Figure 1. Example topic tree A topic tree structure. Beneath foo are bar and baz. A topic exists at baz. Beneath bar is qux. A topic exists at qux.
In the preceding image, topics exist at baz and qux. The topic path for baz is foo/baz. The topic path for qux is foo/bar/qux

You can create a topic at foo/bar/qux without having to create topics at foo or foo/bar beforehand.

There can be multiple topics that have the same name, but topic paths are unique.

When interacting with topics in the topic tree, your clients can reference a topic by its topic path or by a topic selector with a pattern expression that matches the topic path. Clients can use topic selectors to reference sets of topics in the tree that all match the topic selector's pattern expression.

Considerations when designing your topic tree

  • Does the source information have a logical organization?

    If the data structure of the source information is complex, it can be mapped to a hierarchical structure.

  • How many topics?

    If the number of topics is small, a flat topic tree might be appropriate.

  • How do clients subscribe to the data?

    If there are topics that clients generally subscribe to together, these topics can be organized in the same branch of the topic tree. This enables a client use a topic selector to subscribe to the branch of the topic tree and receive updates for all topics in that branch.

  • The size of your topic tree can be constrained by your hardware.

    An extremely large topic tree can cause long GC pauses. Ensure that you do sufficient testing with your topic tree before going to production.

    If the size of your topic tree structure is caused by a lot of duplication, use routing topics to reduce it.

  • A topic cannot be bound to the / topic path. This is because each segment of a topic path must have one or more characters. This means there can be no single topic that acts as the root topic for all possible topics in the topic tree. Instead each top-level topic whose path contains a single part acts as the root topic for their branch of the topic tree.

    However, the / path can be used as a routing path when sending or receiving messages, which uses paths but does not use any topics that are bound to them.