Skip to content
Open
Show file tree
Hide file tree
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
2 changes: 1 addition & 1 deletion .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ jobs:
with:
otp-version: 22.3
elixir-version: 1.10.4
- name: Get depedencies
- name: Get dependencies
run: |
mix local.rebar --force
mix local.hex --force
Expand Down
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -22,4 +22,8 @@ erl_crash.dump
# Ignore package tarball (built via "mix hex.build").
elsa-*.tar

# Temporary files, for example, from tests.
/tmp/

# Misc.
.plt/
25 changes: 0 additions & 25 deletions LICENSE
Original file line number Diff line number Diff line change
Expand Up @@ -175,28 +175,3 @@
of your accepting any such warranty or additional liability.

END OF TERMS AND CONDITIONS

APPENDIX: How to apply the Apache License to your work.

To apply the Apache License to your work, attach the following
boilerplate notice, with the fields enclosed by brackets "[]"
replaced with your own identifying information. (Don't include
the brackets!) The text should be enclosed in the appropriate
comment syntax for the file format. We also recommend that a
file or class name and description of purpose be included on the
same "printed page" as the copyright notice for easier
identification within third-party archives.

Copyright [yyyy] [name of copyright owner]

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
25 changes: 23 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
# Elsa

[![Master](https://github.com/bbalser/elsa/actions/workflows/master.yml/badge.svg)](https://github.com/bbalser/elsa/actions/workflows/master.yml)
[![Module Version](https://img.shields.io/hexpm/v/elsa.svg)](https://hex.pm/packages/elsa)
[![Hex Docs](https://img.shields.io/badge/hex-docs-lightgreen.svg)](https://hexdocs.pm/elsa/)
[![Total Download](https://img.shields.io/hexpm/dt/elsa.svg)](https://hex.pm/packages/elsa)
[![License](https://img.shields.io/hexpm/l/elsa.svg)](https://github.com/bbalser/elsa/blob/master/LICENSE)
[![Last Updated](https://img.shields.io/github/last-commit/bbalser/elsa.svg)](https://github.com/bbalser/elsa/commits/master)

## Description

Elsa is a full-featured Kafka library written in Elixir and extending the `:brod` library with additional support from the `:kafka_protocol` Erlang libraries to provide capabilities not available in `:brod`.
Expand All @@ -13,12 +20,12 @@ As Elsa draws from the Brod library (named for Kafka friend and biographer Max B

## Installation

The package can be installed by adding `elsa` to your list of dependencies in `mix.exs`:
The package can be installed by adding `:elsa` to your list of dependencies in `mix.exs`:

```elixir
def deps do
[
{:elsa, "~> 1.0.0-rc.2"}
{:elsa, "~> 1.0.0-rc.3"}
]
end
```
Expand Down Expand Up @@ -77,3 +84,17 @@ You can find an example of configuring and using Elsa [here](https://github.com/
## Testing

Elsa uses the standard ExUnit testing library for unit testing. For integration testing interactions with Kafka, it uses the [`divo`](https://github.com/smartcitiesdata/divo) library. Run tests with the command `mix test.integration`.

## Copyright and License

Copyright (c) 2019 Brian Balser, Jeff Grunewald, and Johnson Denen

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at [https://www.apache.org/licenses/LICENSE-2.0](https://www.apache.org/licenses/LICENSE-2.0)

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
1 change: 1 addition & 0 deletions config/docs.exs
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
use Mix.Config
4 changes: 2 additions & 2 deletions lib/elsa.ex
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
defmodule Elsa do
@moduledoc """
Provides public api to Elsa. Top-level short-cuts to sub-module functions
Provides public API to Elsa. Top-level short-cuts to sub-module functions
for performing basic interactions with Kafka including listing, creating,
deleting, and validating topics. Also provides a function for one-off
produce_sync of message(s) to a topic.
Expand Down Expand Up @@ -32,7 +32,7 @@ defmodule Elsa do
the Kafka cluster by producers and consumers. Useful for optimizing
interactions by passing the identifier of a standing connection instead
of instantiating a new one at each interaction, but when only a single connection
is required, aleviating the need for the caller to differentiate and pass
is required, alleviating the need for the caller to differentiate and pass
around a name.
"""
@spec default_client() :: atom()
Expand Down
2 changes: 1 addition & 1 deletion lib/elsa/consumer.ex
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
defmodule Elsa.Consumer do
@moduledoc """
Public api to consumer acks asynchronously for simple consumers
Public API to consumer acks asynchronously for simple consumers
"""

import Elsa.Supervisor, only: [registry: 1]
Expand Down
2 changes: 1 addition & 1 deletion lib/elsa/consumer/worker.ex
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,7 @@ defmodule Elsa.Consumer.Worker do
case :brod_consumer.subscribe(consumer_pid, self(), opts) do
{:error, reason} ->
Logger.warn(
"Retrying to subscribe to topic #{state.topic} parition #{state.partition} offset #{state.offset} reason #{
"Retrying to subscribe to topic #{state.topic} partition #{state.partition} offset #{state.offset} reason #{
inspect(reason)
}"
)
Expand Down
2 changes: 1 addition & 1 deletion lib/elsa/producer.ex
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ defmodule Elsa.Producer do
* If a list of messages is supplied as the value, the key is defaulted to an empty string binary.
* Partition can be specified by the keyword option `partition:` and an integer corresponding to a specific
partition, or the keyword option `partitioner:` and the atoms `:md5` or `:random`. The atoms
correspond to partitioner functions that will uniformely select a random partition
correspond to partitioner functions that will uniformly select a random partition
from the total available topic partitions or assign an integer based on an md5 hash of the messages.
"""

Expand Down
2 changes: 1 addition & 1 deletion lib/elsa/registry.ex
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ defmodule Elsa.Registry do
end

@doc """
Start the Elsa registery process and link it to the current process.
Start the Elsa registry process and link it to the current process.
Creates the process registry table in ETS and traps exits during the
init process.
"""
Expand Down
19 changes: 12 additions & 7 deletions mix.exs
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,11 @@ defmodule Elsa.MixProject do
description: description(),
package: package(),
deps: deps(),
homepage: @github,
docs: docs(),
elixirc_paths: elixirc_paths(Mix.env()),
test_paths: test_paths(Mix.env()),
dialyzer: [plt_file: {:no_warn, ".plt/#{System.version()}.plt"}]
dialyzer: [plt_file: {:no_warn, ".plt/#{System.version()}.plt"}],
preferred_cli_env: [docs: :docs]
]
end

Expand All @@ -36,7 +36,7 @@ defmodule Elsa.MixProject do
{:divo_kafka, "~> 0.1.7", only: [:dev, :test, :integration]},
{:placebo, "~> 2.0", only: [:dev, :test]},
{:checkov, "~> 1.0", only: [:test, :integration]},
{:ex_doc, "~> 0.25.3", only: [:dev]},
{:ex_doc, ">= 0.0.0", only: [:docs], runtime: false},
{:dialyxir, "~> 1.1.0", only: [:dev], runtime: false}
]
end
Expand All @@ -50,7 +50,7 @@ defmodule Elsa.MixProject do
defp package do
[
maintainers: ["Brian Balser", "Jeff Grunewald", "Johnson Denen"],
licenses: ["Apache 2.0"],
licenses: ["Apache-2.0"],
links: %{"GitHub" => @github}
]
end
Expand All @@ -61,10 +61,15 @@ defmodule Elsa.MixProject do

defp docs do
[
source_ref: "v#{@version}",
extras: [
"LICENSE": [title: "License"],
"README.md": [title: "Overview"]
],
main: "readme",
homepage_url: @github,
source_url: @github,
extras: ["README.md"],
source_url_pattern: "#{@github}/blob/master/%{path}#L%{line}"
source_ref: "master",
formatters: ["html"]
]
end
end
2 changes: 1 addition & 1 deletion mix.lock
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
"divo_kafka": {:hex, :divo_kafka, "0.1.7", "e8253bb735e001c41f35645ac0429740b6b6350ceb0ae268609f769f0b3883c5", [:mix], [{:divo, "~> 1.1", [hex: :divo, repo: "hexpm", optional: false]}], "hexpm", "25f9b89a1f59f6801b8b1e044eaa8cdce4e0756b4a8512458ea31f9c99ec338f"},
"earmark_parser": {:hex, :earmark_parser, "1.4.17", "6f3c7e94170377ba45241d394389e800fb15adc5de51d0a3cd52ae766aafd63f", [:mix], [], "hexpm", "f93ac89c9feca61c165b264b5837bf82344d13bebc634cd575cb711e2e342023"},
"erlex": {:hex, :erlex, "0.2.6", "c7987d15e899c7a2f34f5420d2a2ea0d659682c06ac607572df55a43753aa12e", [:mix], [], "hexpm", "2ed2e25711feb44d52b17d2780eabf998452f6efda104877a3881c2f8c0c0c75"},
"ex_doc": {:hex, :ex_doc, "0.25.5", "ac3c5425a80b4b7c4dfecdf51fa9c23a44877124dd8ca34ee45ff608b1c6deb9", [:mix], [{:earmark_parser, "~> 1.4.0", [hex: :earmark_parser, repo: "hexpm", optional: false]}, {:makeup_elixir, "~> 0.14", [hex: :makeup_elixir, repo: "hexpm", optional: false]}, {:makeup_erlang, "~> 0.1", [hex: :makeup_erlang, repo: "hexpm", optional: false]}], "hexpm", "688cfa538cdc146bc4291607764a7f1fcfa4cce8009ecd62de03b27197528350"},
"ex_doc": {:hex, :ex_doc, "0.26.0", "1922164bac0b18b02f84d6f69cab1b93bc3e870e2ad18d5dacb50a9e06b542a3", [:mix], [{:earmark_parser, "~> 1.4.0", [hex: :earmark_parser, repo: "hexpm", optional: false]}, {:makeup_elixir, "~> 0.14", [hex: :makeup_elixir, repo: "hexpm", optional: false]}, {:makeup_erlang, "~> 0.1", [hex: :makeup_erlang, repo: "hexpm", optional: false]}], "hexpm", "2775d66e494a9a48355db7867478ffd997864c61c65a47d31c4949459281c78d"},
"jason": {:hex, :jason, "1.2.2", "ba43e3f2709fd1aa1dce90aaabfd039d000469c05c56f0b8e31978e03fa39052", [:mix], [{:decimal, "~> 1.0 or ~> 2.0", [hex: :decimal, repo: "hexpm", optional: true]}], "hexpm", "18a228f5f0058ee183f29f9eae0805c6e59d61c3b006760668d8d18ff0d12179"},
"kafka_protocol": {:hex, :kafka_protocol, "4.0.1", "fc696880c73483c8b032c4bb60f2873046035c7824e1edcb924cfce643cf23dd", [:rebar3], [{:crc32cer, "0.1.8", [hex: :crc32cer, repo: "hexpm", optional: false]}], "hexpm", "687bfd9989998ec8fbbc3ed50d1239a6c07a7dc15b52914ad477413b89ecb621"},
"makeup": {:hex, :makeup, "1.0.5", "d5a830bc42c9800ce07dd97fa94669dfb93d3bf5fcf6ea7a0c67b2e0e4a7f26c", [:mix], [{:nimble_parsec, "~> 0.5 or ~> 1.0", [hex: :nimble_parsec, repo: "hexpm", optional: false]}], "hexpm", "cfa158c02d3f5c0c665d0af11512fed3fba0144cf1aadee0f2ce17747fba2ca9"},
Expand Down
2 changes: 1 addition & 1 deletion test/unit/elsa/consumer/worker_test.exs
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ defmodule Elsa.Consumer.WorkerTest do
[messages: messages, state: create_state(init_args)]
end

data_test "handler can specifiy offset to ack", %{messages: messages, state: state} do
data_test "handler can specify offset to ack", %{messages: messages, state: state} do
set_handler(fn messages ->
offset = messages |> List.first() |> Map.get(:offset)
{ack, offset}
Expand Down