A binary MessageCodec
for the Vert.x event bus, backed by Apache Avro. Put your Avro
SpecificRecord types directly on the event bus — no per-type serializer code, because the
generated record carries its own schema.
| Module | Purpose |
|---|---|
order-schema |
shared Avro schema (Order/OrderLineItem) and generated types, reused by the codec tests and the example |
vertx-avro-codec |
the reusable library — the generic codec |
examples |
a Kafka → event-bus verticle built with RxJava 3, proven by an integration test over a clustered event bus |
benchmarks |
JMH comparison of the Avro codec against Vert.x's default JsonObject codec and a Protobuf codec |
// register once per message type
vertx.eventBus().registerDefaultCodec(Order.class, new AvroMessageCodec<>(Order.class));
// then send the generated Avro record straight onto the bus
vertx.eventBus().send("orders", new Order(1L, "espresso kit", List.of()));Order here is your own Avro SpecificRecord, generated from a .avsc/.avdl schema in your
project by the avro-maven-plugin. The library ships only the generic codec — bring any
SpecificRecord type. (This repo keeps its Order/OrderLineItem fixtures in the separate
order-schema module, so they never enter the library jar.)
This is a deliberately niche tool. It earns its keep when Avro is already your system's lingua franca — e.g. an Avro + Kafka + Schema-Registry shop building Vert.x services — letting the internal event bus reuse the same schemas and generated types as your Kafka topics instead of maintaining a second serialization dialect. If you are not already an Avro shop, prefer Vert.x's JSON codec or the Protobuf how-to.
This repository began in 2018 as an experiment in a custom binary event-bus codec (originally on
Twitter Serial; tagged legacy-2018).
It has since been modernized to Java 21 / Vert.x 5 and re-based on Apache Avro.
mvn -B verify # Java 21vertx-avro-codec is an independent, unofficial project — not affiliated with, endorsed by, or
sponsored by the Apache Software Foundation or the Eclipse Foundation. "Apache Avro" and "Avro" are
trademarks of the Apache Software Foundation; "Eclipse Vert.x" and "Vert.x" are trademarks of the
Eclipse Foundation. These names are used here only descriptively, to indicate compatibility and
integration.