RecordClassDescriptor class overview

Create Record Class Descriptor

Each stream has a unique schema (message class definitions), not shared with other streams. Stream schema is represented by a RecordClassDescriptor class or a collection of RecordClassDescriptor classes in case of a polymorphic stream, a stream that can include messages of different classes. RecordClassDescriptor class includes all fields with data types, references to parents RecordClassDescriptor classes (in case data types form a hierarchy).

There several ways to create RecordClassDescriptor:

  • By listing all message fields:
      final DataField[] fields = {
          new NonStaticDataField ("closePrice", "Close Price", new FloatDataType(FloatDataType.ENCODING_FIXED_DOUBLE, true)),
          new NonStaticDataField ("openPrice", "Open Price", new FloatDataType (FloatDataType.ENCODING_FIXED_DOUBLE, true)),
          new NonStaticDataField ("highPrice", "High", new FloatDataType (FloatDataType.ENCODING_FIXED_DOUBLE, true)),
          new NonStaticDataField ("lowPrice", "Low", new FloatDataType (FloatDataType.ENCODING_FIXED_DOUBLE, true)),
          new NonStaticDataField ("volume", "Volume", new FloatDataType (FloatDataType.ENCODING_FIXED_DOUBLE, true)),
          new NonStaticDataField ("currency", "Currency Code", new VarcharDataType(VarcharDataType.ENCODING_INLINE_VARSIZE, true, true)),
          new StaticDataField("exchange", "Exchange Code", new VarcharDataType("ALPHANUMERIC(10)", true, false), "EPAM")
      };
    
      String typeName = MyBarMessage.class.getName();
      RecordClassDescriptor descriptor = new RecordClassDescriptor(typeName, "My Bar Message", false, null, fields);
    
  • By generating RecordClassDescriptor based on the existing Java or C# class. Refer to introspection to learn more.:
      @SchemaElement(
          name = "org.messages.MyBarMessage",
          title = "Bar Message"
      )
      public class MyBarMessage extends InstrumentMessage {
          public double closePrice;
          public double openPrice;
          public double highPrice;
          public double lowPrice;
          public double volume;	
      }
    
      Introspector introspector = Introspector.createEmptyMessageIntrospector();
      RecordClassDescriptor descriptor = introspector.introspectRecordClass(MyBarMessage.class);
    

Several RecordClassDescriptor classes can be aggregated into a RecordClassSet. RecordClassSet provides a list of all existing RecordClassDescriptor classes as well as top level RecordClassDescriptor classes.

Static Fields

Stream schema fields may be static and non-static. Non-static field, see example above, is a regular type of field where each row has a specific value. Each static field value is identical for all columns and is recorded in the specific stream schema (e.i. “Exchange Code” field in the example above).

Field Data Types

Each field in a stream schema has a specific type, that determines the data type this field may work with.

Data Type Class Name
BOOLEAN BooleanDataType
BYTE IntegerDataType (INT8)
SHORT IntegerDataType (INT16)
INTEGER IntegerDataType (INT32)
INT48 IntegerDataType (INT48)
LONG IntegerDataType (INT64)
PINTERVAL IntegerDataType (PINTERVAL)
FLOAT FloatDataType (IEEE32)
DOUBLE FloatDataType (IEEE64)
DECIMAL FloatDataType (DECIMAL64)
TIME_OF_DAY TimeOfDayDataType
TIMESTAMP DateTimeDataType
CHAR CharDataType
VARCHAR VarcharDataType (UTF8)
ALPHANUMERIC VarcharDataType (ALPHANUMERIC)
BINARY BinaryDataType
ARRAY ArrayDataType
CLASS ClassDataType
ENUM EnumDataType