Current section
11 Versions
Jump to
Current section
11 Versions
Compare versions
10
files changed
+133
additions
-60
deletions
| @@ -5,5 +5,10 @@ CHANGELOG inspiration from http://keepachangelog.com/. | |
| 5 5 | |
| 6 6 | ## Unreleased |
| 7 7 | |
| 8 | + ## [0.2.0] - November 3, 2016 |
| 9 | + * Add last_committed_offset_for |
| 10 | + * Move agent handling to Store |
| 11 | + * Move test helper functions to TestHelper |
| 12 | + |
| 8 13 | ## [0.1.0] - October 25, 2016 |
| 9 14 | * Initial release |
| @@ -22,3 +22,19 @@ A wrapper around KafkaEx so you can mock it in test. | |
| 22 22 | end |
| 23 23 | ``` |
| 24 24 | |
| 25 | + ## Usage |
| 26 | + |
| 27 | + Need more documentation here, but check out |
| 28 | + [kafkamon](https://github.com/avvo/kafkamon) to see this library in use. |
| 29 | + |
| 30 | + In your `config/config.exs`, add: |
| 31 | + |
| 32 | + ```elixir |
| 33 | + config :kafka_impl, :impl, KafkaImpl.KafkaEx |
| 34 | + ``` |
| 35 | + |
| 36 | + In your `config/test.exs`, add: |
| 37 | + |
| 38 | + ```elixir |
| 39 | + config :kafka_impl, :impl, KafkaImpl.KafkaMock |
| 40 | + ``` |
| @@ -4,9 +4,10 @@ | |
| 4 4 | {<<"elixir">>,<<"~> 1.3">>}. |
| 5 5 | {<<"files">>, |
| 6 6 | [<<"lib/kafka_impl.ex">>,<<"lib/kafka_impl/kafka_ex.ex">>, |
| 7 | - <<"lib/kafka_impl/kafka_mock.ex">>,<<"lib/kafka_impl/null_handler.ex">>, |
| 8 | - <<"lib/kafka_impl/util.ex">>,<<"mix.exs">>,<<"CHANGELOG.md">>, |
| 9 | - <<"README.md">>,<<"LICENSE.txt">>]}. |
| 7 | + <<"lib/kafka_impl/kafka_mock.ex">>,<<"lib/kafka_impl/kafka_mock/store.ex">>, |
| 8 | + <<"lib/kafka_impl/kafka_mock/test_helper.ex">>, |
| 9 | + <<"lib/kafka_impl/null_handler.ex">>,<<"lib/kafka_impl/util.ex">>, |
| 10 | + <<"mix.exs">>,<<"CHANGELOG.md">>,<<"README.md">>,<<"LICENSE.txt">>]}. |
| 10 11 | {<<"licenses">>,[<<"MIT">>]}. |
| 11 12 | {<<"links">>, |
| 12 13 | [{<<"Docs">>,<<"https://hexdocs.pm/avrolixr">>}, |
| @@ -18,4 +19,4 @@ | |
| 18 19 | {<<"name">>,<<"kafka_ex">>}, |
| 19 20 | {<<"optional">>,false}, |
| 20 21 | {<<"requirement">>,<<"~> 0.5.0">>}]]}. |
| 21 | - {<<"version">>,<<"0.1.0">>}. |
| 22 | + {<<"version">>,<<"0.2.0">>}. |
| @@ -21,4 +21,7 @@ defmodule KafkaImpl do | |
| 21 21 | |
| 22 22 | @callback produce(KafkaEx.Protocol.Produce.Request.t, Keyword.t) :: nil | :ok | {:ok, integer} | {:error, :closed} | {:error, :inet.posix} | {:error, any} | iodata | :leader_not_available |
| 23 23 | defdelegate produce(request, opts \\ []), to: @impl |
| 24 | + |
| 25 | + @spec offset(binary, number, :calendar.datetime|atom, atom|pid) :: [KafkaEx.Protocol.Offset.Response.t] | :topic_not_found |
| 26 | + defdelegate offset(topic, partition, time, name \\ KafkaEx.Server), to: @impl |
| 24 27 | end |
| @@ -6,6 +6,7 @@ defmodule KafkaImpl.KafkaEx do | |
| 6 6 | defdelegate earliest_offset(topic, partition, name \\ KafkaEx.Server), to: KafkaEx |
| 7 7 | defdelegate fetch(topic, partition, opts \\ []), to: KafkaEx |
| 8 8 | defdelegate produce(req, opts \\ []), to: KafkaEx |
| 9 | + defdelegate offset(topic, partition, time, name \\ KafkaEx.Server), to: KafkaEx |
| 9 10 | |
| 10 11 | def create_no_name_worker(brokers, consumer_group) do |
| 11 12 | GenServer.start_link(KafkaEx.Server, [ |
Loading more files…