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.
- Start a local Diffusion server.
- Clone the repo:
git clone https://github.com/pushtechnology/topic-views-example.git
- Install and run the project:
npm install && npm start
- Open the Diffusion console with a browser and open the Topics tab.
- Observe the new branch of topics under
- Subscribe to the new topics.
- Open the Subscriptions tab to observe their structure and the changing values.
Notice that the topics are named
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
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)>
- Click Add and open the Topics tab.
- Browse to the topic branch
Demos/Fxto see the more intuitively named reference topics created by the topic view.
Using the source value directive
scalar() we have built reference topics with more intelligible names, using values from within the source topic.
The Diffusion Intelligent Data Mesh 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.