347.5. thrift フォーマットの定義

最初のステップは、エクスチェンジのボディーの形式を定義することです。これは .thrift ファイルで次のように定義されています。

tutorial.thrift

namespace java org.apache.camel.dataformat.thrift.generated

enum Operation {
  ADD = 1,
  SUBTRACT = 2,
  MULTIPLY = 3,
  DIVIDE = 4
}

struct Work {
  1: i32 num1 = 0,
  2: i32 num2,
  3: Operation op,
  4: optional string comment,
}