Key (or Key Field)

A key field is member field of your data type that represents part of a unique identifier of your data - much like a primary key in a database.  All key fields combined are called a key, and should form a unique identifier of an element (called an instance) within your Topic.

One example of a key that is comprised of multiple key fields: If you are interested in monitoring the flight status for a commercial flight, the airline and flight number together make up a unique ID of a particular flight.  Each unique combination of the flight number and airline name key fields represents a unique key value, and each unique key value represents a unique instance.

There are no restrictions on the number of key fields you can specify within your data type, and key fields can be nested within multiple layers of structures.

Key fields are specified as part of your data type by using the annotation //@key

Here is an example of a data type that is specifying key fields inside an IDL file:

struct FlightPlan
{
  // --------------------- 
  // Key fields of the data 
  
  // An airline ID is 3 characters, such as UAL or KLM
  string<3> airlineId; //@key  
  short flightNum; //@key 

  // ... Additional components to a flight plan
};