jbertram commented on code in PR #5719: URL: https://github.com/apache/activemq-artemis/pull/5719#discussion_r2121946511
########## artemis-protocols/artemis-mqtt-protocol/src/main/java/org/apache/activemq/artemis/core/protocol/mqtt/MQTTSessionState.java: ########## @@ -565,4 +569,36 @@ public static WillStatus getStatus(byte status) { }; } } + + private static class SubscriptionItem { + private MqttTopicSubscription subscription; + private Integer id; + private Pattern topicNamePattern; + + public SubscriptionItem(MqttTopicSubscription subscription, Integer id) { + setSubscription(subscription); + setId(id); + } + + public MqttTopicSubscription getSubscription() { + return subscription; + } + + public void setSubscription(MqttTopicSubscription subscription) { + this.subscription = subscription; + this.topicNamePattern = Match.createPattern(subscription.topicFilter(), MQTTUtil.MQTT_WILDCARD, true); Review Comment: I think this can be optimized further by only creating the `Pattern` if `id != null`. Compiling the pattern is relatively expensive so it would be good to avoid if possible. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: gitbox-unsubscr...@activemq.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: gitbox-unsubscr...@activemq.apache.org For additional commands, e-mail: gitbox-h...@activemq.apache.org For further information, visit: https://activemq.apache.org/contact