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 spawn_dedicated_client to v2 group subscriber consumer config #3

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from
Draft
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
10 changes: 9 additions & 1 deletion src/brod_group_subscriber_v2.erl
Original file line number Diff line number Diff line change
Expand Up @@ -503,7 +503,15 @@ maybe_start_worker( _MemberId
) -> {ok, pid()}.
start_worker(Client, Topic, MessageType, Partition, ConsumerConfig,
StartOptions) ->
{ok, Pid} = brod_topic_subscriber:start_link( Client
Client1 = case proplists:get_value(spawn_dedicated_client, ConsumerConfig, false) of
false ->
Client;
{true, {Endpoints, ClientConfig} = _Bootstrap} ->
ClientId = list_to_atom(atom_to_list(Client) ++ binary_to_list(<<"-group-subscriber-v2-">>) ++ binary_to_list(Topic) ++ integer_to_list(Partition)),
{ok, _Pid} = brod_client:start_link(Endpoints, ClientId, ClientConfig),
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This does not work as desired, as the client is kept alive even when workers are terminated, e.g. when new assignments are received. See the PR comment for possible approaches

ClientId
end,
{ok, Pid} = brod_topic_subscriber:start_link( Client1
, Topic
, [Partition]
, ConsumerConfig
Expand Down
Loading