Skip to main content

Record Class Descriptor

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:

Create stream schema manually
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.

Generate stream schema via Introspection
@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.

info

Refer to Schema Annotations to learn more about annotations used by introspector to create stream schemas.

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.g. "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 TypeClass Name
BOOLEANBooleanDataType
BYTEIntegerDataType (INT8)
SHORTIntegerDataType (INT16)
INTEGERIntegerDataType (INT32)
INT48IntegerDataType (INT48)
LONGIntegerDataType (INT64)
PINTERVALIntegerDataType (PINTERVAL)
FLOATFloatDataType (IEEE32)
DOUBLEFloatDataType (IEEE64)
DECIMALFloatDataType (DECIMAL64)
TIME_OF_DAYTimeOfDayDataType
TIMESTAMPDateTimeDataType
CHARCharDataType
VARCHARVarcharDataType (UTF8)
ALPHANUMERICVarcharDataType (ALPHANUMERIC)
BINARYBinaryDataType
ARRAYArrayDataType
CLASSClassDataType
ENUMEnumDataType