Overview
This example builds a full market snapshot using schema generated writers, then decodes it with
flyweights. It also loads JSON snapshots from data/order_book_snapshot.json and maps them
into repeated bids, asks, and metadata entries.
Clone and run
-
Install Java 25 and Git, then confirm the toolchain.
java --version -
Clone the examples repository.
git clone https://github.com/mvp-express/examples.git -
Move into the order book example folder.
cd examples/myra-codec-orderbook -
Generate sources and the lock file.
./gradlew codegen -
Run the demo app.
./gradlew run
If you are on Windows, use gradlew.bat instead of ./gradlew.
Concepts highlighted
- Repeated bids and asks via
LevelArrayWriterand flyweight readers. - Optional fields such as
tradingStatusandlastTradewith presence checks. - Metadata key/value entries serialized as repeated fields.
- Zero copy decode path using
OrderBookSnapshotFlyweightandMessageHeader. - Pooled segments and scratch buffers for low allocation encoding.
Files to explore
src/main/resources/schemas/order_book.myra.ymlsrc/main/resources/data/order_book_snapshot.jsonsrc/main/java/express/mvp/myra/codec/examples/ExampleApp.java