Skip to content

Commit 577371e

Browse files
authored
[ISSUE #9352] Fix wrong value in topic-group cache (#9424)
1 parent c9ea749 commit 577371e

File tree

2 files changed

+3
-1
lines changed

2 files changed

+3
-1
lines changed

broker/src/main/java/org/apache/rocketmq/broker/client/ConsumerManager.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -241,7 +241,7 @@ public boolean registerConsumer(final String group, final ClientChannelInfo clie
241241
Set<String> prev = this.topicGroupTable.putIfAbsent(subscriptionData.getTopic(), tmp);
242242
groups = prev != null ? prev : tmp;
243243
}
244-
groups.add(subscriptionData.getTopic());
244+
groups.add(group);
245245
}
246246

247247
boolean r1 =

broker/src/test/java/org/apache/rocketmq/broker/client/ConsumerManagerTest.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717

1818
package org.apache.rocketmq.broker.client;
1919

20+
import com.google.common.collect.ImmutableSet;
2021
import io.netty.channel.Channel;
2122
import org.apache.rocketmq.broker.BrokerController;
2223
import org.apache.rocketmq.broker.filter.ConsumerFilterManager;
@@ -179,6 +180,7 @@ public void queryTopicConsumeByWhoTest() {
179180
register();
180181
final HashSet<String> consumeGroup = consumerManager.queryTopicConsumeByWho(TOPIC);
181182
assertFalse(consumeGroup.isEmpty());
183+
assertThat(consumerManager.queryTopicConsumeByWho(TOPIC)).isEqualTo(ImmutableSet.of(GROUP));
182184
}
183185

184186
@Test

0 commit comments

Comments
 (0)