namespace cpp org.example namespace java org.example enum AnEnum { ONE = 1, TWO = 2, THREE = 3 } struct SomeMessage { 1: bool aBooleanField, 2: i8 aByteField, 3: i16 aShortIntField, 4: i32 aNormalIntField, 5: i64 aLongIntField, 10: double aDoubleField, 20: string aStringField, 22: binary aBinaryField, // Fields can have default values. 100: AnEnum anEnumFieldWithDefault = AnEnum.THREE, // Fields can be optional. 200: optional i16 anOptionalIntField } // Exceptions are structures too. exception SomeException { 1: list<string> aStringList, 2: set<i8> aByteSet, 3: map<i16, string> aMap } service AnInterface { void ping (), bool aMethod (1: i16 argShort, 2: i64 argLong), oneway void aOnewayMethod (1: SomeMessage message) } service AnotherInterface extends AnInterface { void yetAnotherMethod (1: SomeMessage message) throws (1: SomeException ex) }
Namespaces per language
A spectrum of basic types
Containers for other types
Fields can be optional
Explicit field and argument identifiers for versioning
Methods can be oneway
Methods can throw exceptions