Initial Setup
Requirements
The software is only Windows compatible. You will need two libraries:
- Microsoft Bond
- ZeroMQ
C++
We recommend using vcpkg.
vcpkg github
vcpkg help
Suppose you have vcpkg installed into C:\vcpkg>
, you can navigate to it and run the following command:
C:\vcpkg>vcpkg search bond
If you wish to statically compile, then;
C:\vcpkg>vcpkg install bond:x64-windows-static
Otherwise
C:\vcpkg>vcpkg install bond:x64-windows
For 32bit versions substitute x64 with x86. Also, make sure you’ve run C:\vcpkg>vcpkg integrate install
at some point to let Visual Studio know where to find the imported libraries. For Clion, or any other IDE you might be using, please look up the manufacturer specific steps to see that vcpkg is integrated with your IDE.
C#
Use Nuget. You will want:
- Bond.CSharp by Microsoft
- ZeroMQ by metadings, Pieter Hintjens, Martin Sustrik
Message Transport: ZeroMQ
If you want to send messages from one socket to another without using a message broker then ZeroMQ is a great option. But ZeroMQ is more than just that. The real power of ZeroMQ is in the message patterns that it enables. With certain socket type combinations, you can create systems that are asynchronous. The sockets you will be hearing more about in this documentation are:
- Push
- Pull
- Dealer
- Router
We highly recommend skimming the ZeroMQ guide. Essentially, working with our API means working with ZeroMQ sockets.
You will primarily be pushing messages on the Push socket and listening on three Dealer sockets.
Message Serialization: Bond
Ok, so you can send messages using ZeroMQ. But how do the different components of the system understand what the other is saying? Are JSON and XML the best we can do?
There is another class of libraries that consist of binary serialization and the mechanics for most of them for a user standpoint are largely similar:
- You define your schema in the library IDL (interface definition language)
- Run the library codegen tool on the IDL to generate language specific files
- Import the generated files into your project
The point is that in doing so all parties of the system agree to adhere to a common set of promises on how to wrap and unwrap data. Therefore, a stream of bytes is simply passed around that is much more performant and easy to work with when compared to JSON or XML. We use Microsoft Bond because of its advanced type system, type-safe lazy deserialization and extremely good performance.
Parietal Numerics Setup
We assume that you have already installed the Parietal Numerics software on your developer machine. We also assume that you either have a trial or valid license so you can test the back and forth with the engine while you are developing.
The serialization files are located in your install folder: C:\Program Files\Parietal Numerics\bindings\.