Browse Source

feat(kafka consumer): allow custom group id

Fixes https://emqx.atlassian.net/browse/EMQX-12273
Fixes EMQX-12273

When consuming messages in Kafka in Alibaba Cloud, the group needs to be configured in
advance, and then the consumer can use the group to consume messages. Automatic group
creation is generally not allowed online.
Thales Macedo Garitezi 1 year ago
parent
commit
3942b371d7

+ 8 - 4
apps/emqx_bridge_kafka/test/emqx_bridge_v2_kafka_consumer_SUITE.erl

@@ -363,10 +363,14 @@ t_custom_group_id(Config) ->
                     #{<<"parameters">> => #{<<"group_id">> => CustomGroupId}}
                 ),
             [Endpoint] = emqx_bridge_kafka_impl:hosts(BootstrapHosts),
-            ?assertMatch(
-                {ok, [{_, CustomGroupId, _}]},
-                brod:list_groups(Endpoint, _ConnOpts = #{})
-            ),
+            ?retry(100, 10, begin
+                {ok, Groups} = brod:list_groups(Endpoint, _ConnOpts = #{}),
+                ?assertMatch(
+                    [_],
+                    [Group || Group = {_, Id, _} <- Groups, Id == CustomGroupId],
+                    #{groups => Groups}
+                )
+            end),
             ok
         end,
         []