[Work Notes] msgpack-idl How-To

msgpack-idl How-To

Step 1: Get the msgpack-idl

$ git clone git://github.com/msgpack/msgpack-idl.git

Step 2: Install the required Ruby tool

$ sudo apt-get install ruby1.9.1

Step 3: Go to msgpack-idl folder

$ sudo gem install msgpack-idl
$ sudo msgpack-idl --install java

Step 4: Create a sample file sample with the following content:

message Node {
  1: string address
  2: map<string,string> properties
  3: optional string? description
}
message StorageNode < Node {
  4: long capacity
  5: optional int weight = 1
}

Step 5: Generate Java code with the following commands:

$ msgpack-idl --example sample > sample.msgspec
$ msgpack-idl -g java sample.msgspec -o ./out/

More information: http://wiki.msgpack.org/display/MSGPACK/Design+of+IDL

Note: The Ruby implementation seems to only support Java code generation. Another IDL implementation written in Haskell is more active and can generate C++ code. Will study this further if IDL is really needed for our IPC.

Link: http://hackage.haskell.org/packages/hackage.html


Comments & Feedback