kafka_protocol

Kafka protocol library for Erlang/Elixir

This library provides:

See brod for a complete kafka client implementation.

Compression Support

Since 4.0, this lib no longer includes snappyer and lz4b as rebar dependencies. However kafka_protocol still defaults to use snappyer and lz4b_frame for compress and decompress.

Provide compression module overrides

User may override default compression libs with modules having below APIs implemented:

-callback compress(iodata()) -> iodata().
-callback decompress(binary()) -> iodata().

There are two approaches to inject such dynamic dependencies to kakfa_protocol:

Set application environment

e.g. Set {provide_compression, [{lz4, my_lz4_module}]} in kafka_protocol application environment, (or provide from sys.config).

Call kpro:provide_compression

e.g. kpro:provide_compression([{lz4, my_lz4_module}]).

Test (make eunit)

To make a testing environment locally (requires docker) run make test-env. To test against a specific kafka version (e.g. 0.9), set environment variable KAFKA_VERSION. e.g. export KAFKA_VERSION=0.9

To test with an existing kafka cluster set below environment variables: