# EventSerializer

[![Build Status](]( [![Hex docs](]( [![Hex Version](]( [![License](](

This lib is responsible to encode and decode events from Kafka. it also includes a cache to fetch schemas.

## Installation

def deps do
    {:event_serializer, "~> 2.0.0"}

## Usage

After add the lib in the dependencies add it in the applications list, `:event_serializer`.

In your `config.exs` add the following vars:

config :avlizer,
  avlizer_confluent: %{
    schema_registry_url: 'http://localhost:8081'

config :event_serializer,
  schema_registry_url: "http://localhost:8081",
  topic_names: [""],
  enabled: true
We need those two `schema_registry_url` because the `avlizer` requires it.

Under tests you will want to disable the starting the child processes that
caches the schemes, so it doesn't try and connect to Schema Registry and die
enabled: false

### Encoding Messages

Just call the `` passing the message.

The message needs to be a list of tuples. It's required by the `avlizer`.

{:ok, encoded_message} =

### Decoding Messages

Just call the `` passing the message.

{:ok, decoded_message} =

The message is also converted to a map with string key within the response.

String keys are recommend due the performance.

## Publish to HEX

mix hex.publish