0

RocketMQ supports filter by tag, where I dig into the source code of the Broker. It seems the broker do the following comparison: subscriptionData.getCodeSet().contains(tagsCode.intValue()); in org.apache.rocketmq.broker.filter.ExpressionMessageFilter#isMatchedByConsumeQueue. So i wonder if there is any chance two tags has the same hash code, and if that happens, some msg will not be filtered? I can't find any code comparing the actual tag String in Broker, am i missing something?

P.S.: my RocketMQ version is: 4.2.0-incubating-SNAPSHOT

telmo
  • 153
  • 8

1 Answers1

0

The hashcode of an int is itself (source), so the hashcode of tagsCode.intValue() is itself. So as long as each code has a unique int value in the first place, there will be no hashcode collision.

Tim
  • 2,027
  • 15
  • 24