Using Topic Views 3: Extracting Source Topic Values

Extracting part of the source topic value

You may notice that the new topic branch created in the prior chapter Demos/Sportsbook/Football/England/All/  holds exclusively JSON topics. Using a source value directive we can selectively unpack the structure of those JSON topics to create new topics.

  • Open the Topic Views tab.
  • Click Add and create a new topic view named All/away win.
  • Give it the specification: map ?Demos/Sportsbook/Football/England/All// to "<path(0)>/away win" as "<value(/away win)>".

  • Click Add and open the Topics tab.
  • Note the new topics underneath the team topic, for example: Demos/Sportsbook/Football/England/All/Manchester United vs Arsenal . These topics contain the values of the field away win within their parent topic. If that field is absent, no corresponding away win topic is created.

Notice the new value mapping clause as <value(/away win)>, which extracts the field away win from the source topic in creating the reference topic. This is a JSON Pointer.

Using the value mapping clause, it is possible to expose a subset of a dataset to the audience to achieve greater data efficiency. The reference topics can have different topic permissions, enabling you to share a subset of the dataset with more liberal permissions.

Summary: Use the value mapping clause value() to extract parts of source topics into reference topics.

Next: Throttling reference topics.

diffusion

Enjoy the rich functionality of Diffusion 6.7 as part of your event-driven application.

diffusion
Quick Start Guide

Step-by-Step guides to get started

diffusion
Diffusion Cloud

SaaS offering to focus on business

diffusion
Diffusion On-Premise

A holistic pub-sub platform for real-time apps