Skip to content

Commit

Permalink
fix: Return :commit since :ack does not commit in v2 (#84)
Browse files Browse the repository at this point in the history
## Checklist

<!--
For each bullet, ensure your pr meets the criteria and write a note
explaining how this PR relates. Mark them as complete as they are done.
All top-level checkboxes should be checked regardless of their relevance
to the pr with a note explaining whether they are relevant or not.
-->

- [x] Code conforms to the [Elixir
Styleguide](https://github.com/christopheradams/elixir_style_guide)

## Problem

<!--
What is the problem you're solving or feature you're implementing? Link
to any Jira tickets or previous discussions of the issue.
-->

When using the `brod_group_subscriber_v2` our `handle_message/3`
callback was returning `{:ok, :ack, state}`. This was the old way to
commit messages; in v2, it only acks and doesn't commit based on this
comment:

https://github.com/kafka4beam/brod/blob/master/src/brod_group_subscriber_worker.erl#L85

## Details

<!--
Include a brief overview of the technical process you took (or are going
to take!) to get from the problem to the solution.
-->

Changed to commit
  • Loading branch information
abel-stord authored Mar 8, 2024
1 parent 58aba7b commit 15bd941
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions lib/kafee/consumer/brod_worker.ex
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ defmodule Kafee.Consumer.BrodWorker do

@doc false
@impl :brod_group_subscriber_v2
@spec handle_message(:brod.message(), map()) :: {:ok, :ack, map()}
@spec handle_message(:brod.message(), map()) :: {:ok, :commit, map()}
def handle_message(
message,
%{
Expand All @@ -51,6 +51,6 @@ defmodule Kafee.Consumer.BrodWorker do
headers: message[:headers]
})

{:ok, :ack, state}
{:ok, :commit, state}
end
end

0 comments on commit 15bd941

Please sign in to comment.