[
https://issues.apache.org/jira/browse/ARTEMIS-4532?focusedWorklogId=902364&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-902364
]
ASF GitHub Bot logged work on ARTEMIS-4532:
-------------------------------------------
Author: ASF GitHub Bot
Created on: 29/Jan/24 16:44
Start Date: 29/Jan/24 16:44
Worklog Time Spent: 10m
Work Description: jbertram commented on code in PR #4710:
URL: https://github.com/apache/activemq-artemis/pull/4710#discussion_r1469884438
##########
artemis-protocols/artemis-mqtt-protocol/src/main/java/org/apache/activemq/artemis/core/protocol/mqtt/MQTTUtil.java:
##########
@@ -138,25 +138,71 @@ public class MQTTUtil {
public static final int DEFAULT_MAXIMUM_PACKET_SIZE = MAX_PACKET_SIZE;
- public static String convertMqttTopicFilterToCore(String filter,
WildcardConfiguration wildcardConfiguration) {
- return convertMqttTopicFilterToCore(null, filter, wildcardConfiguration);
- }
+ public static final WildcardConfiguration MQTT_WILDCARD = new
WildcardConfiguration().setDelimiter(SLASH).setAnyWords(HASH).setSingleWord(PLUS);
- public static String convertMqttTopicFilterToCore(String prefixToAdd,
String filter, WildcardConfiguration wildcardConfiguration) {
- if (filter == null) {
- return "";
+ /**
+ * This method takes the MQTT-related input and translates it into the
proper name for a core subscription queue. The
+ * {@code topicFilter} may be either for a shared subscription in the
format {@code $share/<shareName>/<topicFilter>}
+ * or a normal MQTT topic filter (e.g. {@code a/b/#}, {@code a/+/c}, {@code
a/b/c}, etc.).
+ *
+ * @param topicFilter the MQTT topic filter
+ * @param clientId the MQTT client ID, used for normal (i.e. non-shared)
subscriptions
+ * @param wildcardConfiguration the {@code WildcardConfiguration} governing
the core broker
+ * @return the name of the core subscription queue based on the input
+ */
+ public static String getCoreQueueFromMqttTopic(String topicFilter, String
clientId, WildcardConfiguration wildcardConfiguration) {
+ if (topicFilter == null || clientId == null || wildcardConfiguration ==
null) {
+ throw new IllegalArgumentException();
Review Comment:
Funny. I had already started making that change!
Issue Time Tracking
-------------------
Worklog Id: (was: 902364)
Time Spent: 4.5h (was: 4h 20m)
> MQTT-to-core wildcard conversion is broken
> ------------------------------------------
>
> Key: ARTEMIS-4532
> URL: https://issues.apache.org/jira/browse/ARTEMIS-4532
> Project: ActiveMQ Artemis
> Issue Type: Bug
> Reporter: Justin Bertram
> Assignee: Justin Bertram
> Priority: Major
> Time Spent: 4.5h
> Remaining Estimate: 0h
>
> Currently when an MQTT topic filter contains characters from the configured
> [wildcard
> syntax|https://activemq.apache.org/components/artemis/documentation/latest/wildcard-syntax.html#wildcard-syntax]
> the conversion to/from this syntax breaks.
> For example, when using the default wildcard syntax if an MQTT topic filter
> contains a {{.}} the conversion from the MQTT wildcard syntax to the core
> wildcard syntax and back will result in the {{.}} being replaced with a {{/}}.
--
This message was sent by Atlassian Jira
(v8.20.10#820010)