You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@activemq.apache.org by jb...@apache.org on 2024/04/20 04:42:52 UTC
(activemq-artemis) branch main updated: ARTEMIS-4727 fix STOMP durable sub doc and property precedence
This is an automated email from the ASF dual-hosted git repository.
jbertram pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/activemq-artemis.git
The following commit(s) were added to refs/heads/main by this push:
new ed59b0ea91 ARTEMIS-4727 fix STOMP durable sub doc and property precedence
ed59b0ea91 is described below
commit ed59b0ea91e6238933143a9269d8dd80babf8e0a
Author: Justin Bertram <jb...@apache.org>
AuthorDate: Tue Apr 16 09:27:05 2024 -0500
ARTEMIS-4727 fix STOMP durable sub doc and property precedence
---
.../core/protocol/stomp/VersionedStompFrameHandler.java | 10 +++++-----
docs/user-manual/stomp.adoc | 6 ++++--
2 files changed, 9 insertions(+), 7 deletions(-)
diff --git a/artemis-protocols/artemis-stomp-protocol/src/main/java/org/apache/activemq/artemis/core/protocol/stomp/VersionedStompFrameHandler.java b/artemis-protocols/artemis-stomp-protocol/src/main/java/org/apache/activemq/artemis/core/protocol/stomp/VersionedStompFrameHandler.java
index b4cd5ead7b..ac94d233ed 100644
--- a/artemis-protocols/artemis-stomp-protocol/src/main/java/org/apache/activemq/artemis/core/protocol/stomp/VersionedStompFrameHandler.java
+++ b/artemis-protocols/artemis-stomp-protocol/src/main/java/org/apache/activemq/artemis/core/protocol/stomp/VersionedStompFrameHandler.java
@@ -261,12 +261,12 @@ public abstract class VersionedStompFrameHandler {
String selector = frame.getHeader(Stomp.Headers.Subscribe.SELECTOR);
String ack = frame.getHeader(Stomp.Headers.Subscribe.ACK_MODE);
String id = frame.getHeader(Stomp.Headers.Subscribe.ID);
- String durableSubscriptionName = frame.getHeader(Stomp.Headers.Subscribe.DURABLE_SUBSCRIBER_NAME);
+ String durableSubscriptionName = frame.getHeader(Stomp.Headers.Subscribe.DURABLE_SUBSCRIPTION_NAME);
if (durableSubscriptionName == null) {
- durableSubscriptionName = frame.getHeader(Stomp.Headers.Subscribe.DURABLE_SUBSCRIPTION_NAME);
- }
- if (durableSubscriptionName == null) {
- durableSubscriptionName = frame.getHeader(Stomp.Headers.Subscribe.ACTIVEMQ_DURABLE_SUBSCRIPTION_NAME);
+ durableSubscriptionName = frame.getHeader(Stomp.Headers.Subscribe.DURABLE_SUBSCRIBER_NAME);
+ if (durableSubscriptionName == null) {
+ durableSubscriptionName = frame.getHeader(Stomp.Headers.Subscribe.ACTIVEMQ_DURABLE_SUBSCRIPTION_NAME);
+ }
}
RoutingType routingType = getRoutingType(frame.getHeader(Headers.Subscribe.SUBSCRIPTION_TYPE), frame.getHeader(Headers.Subscribe.DESTINATION));
boolean noLocal = false;
diff --git a/docs/user-manual/stomp.adoc b/docs/user-manual/stomp.adoc
index 706c428a9b..d04cf209c2 100644
--- a/docs/user-manual/stomp.adoc
+++ b/docs/user-manual/stomp.adoc
@@ -208,10 +208,12 @@ The combination of these two headers will form the identity of the durable subsc
To delete a durable subscription the `client-id` header must be set on the `CONNECT` frame and the `durable-subscription-name` must be set on the `UNSUBSCRIBE` frame.
The values for these headers should match what was set on the `SUBSCRIBE` frame to delete the corresponding durable subscription.
-Aside from `durable-subscription-name`, the broker also supports `durable-subscriber-name` (a deprecated property used before `durable-subscription-name`) as well as `activemq.subscriptionName` from ActiveMQ "Classic".
+Aside from `durable-subscription-name`, the broker also supports `durable-subscriber-name` (a deprecated property used before `durable-subscription-name`) as well as `activemq.subscriptionName` from ActiveMQ Classic.
This is the order of precedence if the frame contains more than one of these:
-1) `durable-subscriber-name` 2) `durable-subscription-name` 3) `activemq.subscriptionName`
+. `durable-subscription-name`
+. `durable-subscriber-name`
+. `activemq.subscriptionName`
It is possible to pre-configure durable subscriptions since the STOMP implementation creates the queue used for the durable subscription in a deterministic way (i.e. using the format of `client-id`.`subscription-name`).
For example, if you wanted to configure a durable subscription on the address `myAddress` with a client-id of `myclientid` and a subscription name of `mysubscription` then configure the durable subscription: