Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Small cleanup to README #9

Merged
merged 2 commits into from
Oct 26, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
37 changes: 21 additions & 16 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,17 +30,29 @@ features as the project develops. Key features include:
- **SASL Authentication**: Currently supports plain authentication.
- **Protocol Compatibility**: Supports recent protocol versions, with forward compatibility in mind.

## Usage
## Installation

Checkout the `Klife.Client` docs to have more details, but the basic usage is something like this:
### Add `klife` to your list of dependencies in `mix.exs`:

#### 0. Add on deps
```elixir
def deps do
[
{:klife, "~> 0.1.0"}
]
end
```

## Basic Usage

### Define your application client

```elixir
{:klife, "~> 0.1.0"},
defmodule MyApp.Client do
use Klife.Client, otp_app: :my_app
end
```

#### 1. Add config
### Add basic configuration

```elixir
config :my_app, MyApp.Client,
Expand All @@ -49,16 +61,7 @@ config :my_app, MyApp.Client,
ssl: false
]
```

#### 2. Use it on a module

```elixir
defmodule MyApp.Client do
use Klife.Client, otp_app: :my_app
end
```

#### 3. Starting it on your supervision tree
### Add the client to the supervision tree

```elixir
children = [ MyApp.Client ]
Expand All @@ -67,13 +70,15 @@ opts = [strategy: :one_for_one, name: Example.Supervisor]
Supervisor.start_link(children, opts)
```

#### 4. Call the producer API on your code
### Call the producer API

```elixir
my_rec = %Klife.Record{value: "my_val_1", topic: "my_topic_1"}
{:ok, %Klife.Record} = MyApp.Client.produce(my_rec)
```

Checkout the `Klife.Client` [docs](https://hexdocs.pm/klife/Klife.Client.html) for more details

## Producer performance

In order to test the performance I've prepared a benchmark that uses [benchee](https://github.com/bencheeorg/benchee) to produce
Expand Down
Loading