Nick Isaacs - March 05, 2015
Here at VictorOps, we are going through the process of overhauling the serialization framework that we use for inter and intra process communication. We evaluated several great options including Kryo (and its Scala companion Chill), Protobuffers, and Thrift. In the process, we put together a little test project to help us decide which of these choices was right for us. Testing Thrift posed some challenges as the tooling, while quite mature, wasn’t quite as plug-n-play with our local development environment as we would have liked. The following instructions assume a basic knowledge of the Scala/SBT framework, Thrift, and (optionally) Intellij.
Create a new project with a
build.sbt file and add the following lines: This will add the Thrift and Scrooge dependencies to your sbt project.
If you do not already have a
project/plugins.sbt file, create one and add the following line:
Create a new directory to hold your Thrift files (by default, Scrooge will check in
src/main/thrift, which worked fine for us).
Define some Thrift files, if you want, here is a simple example:
By default, Intellij marks everything in the
target/ directory as ‘excluded’ for builds. We are gonna have to do something about that.
* - Open up the "project structure" window & click "modules" in the right hand menu. [![Screenshot 2015-03-03 15.16.27](//wwwimg.victorops.com/2015/03/Screenshot-2015-03-03-15.16.271-300x157.png)](//wwwimg.victorops.com/2015/03/Screenshot-2015-03-03-15.16.271.png) * - Click on the name of your project, you should see the directory structure appear [![Screenshot 2015-03-03 15.17.05](//wwwimg.victorops.com/2015/03/Screenshot-2015-03-03-15.17.05-300x229.png)](//wwwimg.victorops.com/2015/03/Screenshot-2015-03-03-15.17.05.png) * - Click "target" and uncheck "Excluded" [![Screenshot 2015-03-03 15.17.13](//wwwimg.victorops.com/2015/03/Screenshot-2015-03-03-15.17.13-300x229.png)](//wwwimg.victorops.com/2015/03/Screenshot-2015-03-03-15.17.13.png) * - Expand "target" and mark all subfolders as "Excluded" except for scala-version.no [![screenshot_2015-03-05_13.05.49](//wwwimg.victorops.com/2015/03/screenshot-2015-03-05-13.05.49-300x281.png)](//wwwimg.victorops.com/2015/03/screenshot-2015-03-05-13.05.49.png) * - Expand "scala-version.no" and mark all folders as "Excluded" except for "src_managed" which you should mark as "Source" [![Screenshot 2015-03-03 15.18.30](//wwwimg.victorops.com/2015/03/Screenshot-2015-03-03-15.18.30-300x230.png)](//wwwimg.victorops.com/2015/03/Screenshot-2015-03-03-15.18.30.png)
cleanafter making edits.
Happy serializing :)