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

Add start_link/1 function to GroupMemberSupervisor #69

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
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
14 changes: 11 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -193,9 +193,17 @@ Batch message consumers receive a list of messages and work as part of the `:bro
3. Add `Kaffe.GroupMemberSupervisor` as a supervisor in your
supervision tree

```elixir
supervisor(Kaffe.GroupMemberSupervisor, [])
```
```elixir
def start(_type, _args) do

children = [
Kaffe.GroupMemberSupervisor
]

opts = [strategy: :one_for_all, name: MyApp.Supervisor]
Supervisor.start_link(children, opts)
end
```

### async message acknowledgement

Expand Down
4 changes: 4 additions & 0 deletions lib/kaffe/group_member/manager/group_member_supervisor.ex
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,10 @@ defmodule Kaffe.GroupMemberSupervisor do

require Logger

def start_link(_) do
start_link()
end

def start_link do
Supervisor.start_link(__MODULE__, :ok, name: name())
end
Expand Down
4 changes: 2 additions & 2 deletions lib/kaffe/group_member/subscriber/subscriber.ex
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ defmodule Kaffe.Subscriber do
end

def handle_cast({:commit_offsets, topic, partition, generation_id, offset}, state) do
Logger.debug "Ready to commit offsets for #{state.topic} / #{state.partition} / #{generation_id} at offset: #{offset}"
Logger.debug "Committing offsets for #{state.topic} / #{state.partition} / #{generation_id} at offset: #{offset}"

# Is this the ack we're looking for?
^topic = state.topic
Expand All @@ -123,7 +123,7 @@ defmodule Kaffe.Subscriber do
end

def handle_cast({:request_more_messages, offset}, state) do
Logger.debug "Ready to consume more messages of #{state.topic} / #{state.partition} at offset: #{offset}. Offset has not been commited back"
Logger.debug "Requesting messages from #{state.topic} / #{state.partition} at offset: #{offset}"

:ok = kafka().consume_ack(state.subscriber_pid, offset)

Expand Down
2 changes: 1 addition & 1 deletion mix.exs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ defmodule Kaffe.Mixfile do

def project do
[app: :kaffe,
version: "1.7.0",
version: "1.8.0",
description: "An opinionated Elixir wrapper around brod, the Erlang Kafka client, that supports encrypted connections to Heroku Kafka out of the box.",
name: "Kaffe",
source_url: "https://github.com/spreedly/kaffe",
Expand Down