Using Topic Views 5: Naming Reference Topic With Topic Content

9 Jul 19

Using topic content to name a reference topic

Let’s quickly introduce a new topic tree before we go any further, which lends itself well to this use case. The Demo/Fx topic tree is driven by this script: https://github.com/pushtechnology/topic-views-example. It pulls real market data from truefx.com to populate a tree of foreign exchange prices.

Browsing new FX related topics.

  • Subscribe to the new topics.
  • Open the Subscriptions tab to observe their structure and the changing values.

Notice that the topics are named Demos/Fx/raw/0, 1, 2, etc., and that each topic contains the field  pairName that holds a string giving a more understandable name for the particular currency trade, such as “EUR:USD”. In this example, we will use a topic view to create intuitively named reference topics using the pairName values.

Naming reference topics from topic content

Discussion: It is not always possible to adjust the topic publishing habits of another Diffusion client: it may belong to a third party with different priorities. Using a topic view can quickly and pragmatically solve this problem.

  • Open the Topic Views tab.
  • Click Add and create a new topic view named Demos/Fx currency pairs
  • Give it the specification:map ?Demos/Fx/raw/.* to Demos/Fx/<scalar(/pairName)>

Adding the topic view “Demos/Fx currency pairs”

  • Click Add and open the Topics tab.
  • Browse to the topic branch Demos/Fx to see the more intuitively named reference topics created by the topic view.

Browsing the new intuitively named currency pair topics

Summary

Using the source value directive scalar() we have built reference topics with more intelligible names, using values from within the source topic.

Next: Changing topic properties of reference topics.


The Diffusion Intelligent Data Platform manages, optimizes, and integrates data among devices, systems, and applications. Push Technology pioneered and is the sole provider of real-time delta data streaming™ technology that powers mission-critical business applications worldwide. Leading brands use Push Technology to fuel revenue growth, customer engagement, and business operations. The products, Diffusion® and Diffusion Cloud™, are available on-premise, in-the-cloud, or in a hybrid configuration, to fit the specific business and infrastructure requirements of the applications operating in today’s mobile obsessed, everything connected world. Learn how Push Technology can reduce infrastructure costs, and increase speed, efficiency, and reliability, of your web, mobile, and IoT application.

LEARN MORE: Case Studies and Developer Resources