You are viewing a plain text version of this content. The canonical link for it is here.
Posted to gitbox@activemq.apache.org by "jbertram (via GitHub)" <gi...@apache.org> on 2025/06/02 19:04:35 UTC
Re: [PR] ARTEMIS-5121 Improve performance of SUBSCRIPTION_IDENTIFIER fetching from MQTT session state [activemq-artemis]
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-unsubscribe@activemq.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: gitbox-unsubscribe@activemq.apache.org
For additional commands, e-mail: gitbox-help@activemq.apache.org
For further information, visit: https://activemq.apache.org/contact