@@ -266,14 +266,30 @@ private void createTopicAndVerifyEvents(String topicDomain, String topicTypePart
266266 final String [] expectedEvents ;
267267 if (topicDomain .equalsIgnoreCase ("persistent" ) || topicTypePartitioned .equals ("partitioned" )) {
268268 if (topicTypePartitioned .equals ("partitioned" )) {
269- expectedEvents = new String []{
270- "CREATE__BEFORE" ,
271- "CREATE__SUCCESS" ,
272- "LOAD__BEFORE" ,
273- "CREATE__BEFORE" ,
274- "CREATE__SUCCESS" ,
275- "LOAD__SUCCESS"
276- };
269+ if (topicDomain .equalsIgnoreCase ("persistent" )) {
270+ expectedEvents = new String []{
271+ "CREATE__BEFORE" ,
272+ "CREATE__SUCCESS" ,
273+ "LOAD__BEFORE" ,
274+ "LOAD__SUCCESS"
275+ };
276+ } else {
277+ // For non-persistent partitioned topic, only metadata is initially created;
278+ // partitions are created when the client connects.
279+ // PR #23680 currently records creation events at metadata creation,
280+ // and the broker records them again when partitions are loaded,
281+ // which can result in multiple events.
282+ // Ideally, #23680 should not record the event here,
283+ // because the topic is not fully created until the client connects.
284+ expectedEvents = new String []{
285+ "CREATE__BEFORE" ,
286+ "CREATE__SUCCESS" ,
287+ "LOAD__BEFORE" ,
288+ "CREATE__BEFORE" ,
289+ "CREATE__SUCCESS" ,
290+ "LOAD__SUCCESS" ,
291+ };
292+ }
277293 } else {
278294 expectedEvents = new String []{
279295 "LOAD__BEFORE" ,
@@ -338,7 +354,7 @@ public void testCreateTopicEvent(String topicTypePersistence, String topicTypePa
338354 Awaitility .await ().during (3 , TimeUnit .SECONDS )
339355 .untilAsserted (() -> {
340356 if (topicTypePartitioned .equals ("partitioned" ) && topicTypePersistence .equals ("non-persistent" )) {
341- // For non-persistent partitioned topics , only metadata is initially created;
357+ // For non-persistent partitioned topic , only metadata is initially created;
342358 // partitions are created when the client connects.
343359 // PR #23680 currently records creation events at metadata creation,
344360 // and the broker records them again when partitions are loaded,
0 commit comments