Github user gemmellr commented on a diff in the pull request:
https://github.com/apache/activemq-artemis/pull/1337#discussion_r121920556
--- Diff:
artemis-protocols/artemis-amqp-protocol/src/main/java/org/apache/activemq/artemis/protocol/amqp/proton/ProtonServerSenderContext.java
---
@@ -733,20 +734,31 @@ private static boolean hasCapabilities(Symbol symbol,
Source source) {
return false;
}
- private static String createQueueName(String clientId,
+ private static String createQueueName(boolean useLegacyQueueNaming,
+ String clientId,
String pubId,
boolean shared,
boolean global,
boolean isVolatile) {
- String queue = clientId == null || clientId.isEmpty() || global ?
pubId : clientId + "." + pubId;
- if (shared) {
- if (queue.contains("|")) {
- queue = queue.split("\\|")[0];
- }
- if (isVolatile) {
- queue = "nonDurable" + "." + queue;
+ if (useLegacyQueueNaming) {
+ String queue = clientId == null || clientId.isEmpty() ? pubId :
clientId + "." + pubId;
+ if (shared) {
+ if (queue.contains("|")) {
+ queue = queue.split("\\|")[0];
+ }
+ if (isVolatile) {
+ queue += ":shared-volatile";
+ }
+ if (global) {
+ queue += ":global";
+ }
}
+ return queue;
+ } else {
+ final boolean durable = !isVolatile;
+ final String subscriptionName = pubId.contains("|") ?
pubId.split("\\|")[0] : pubId;
+ final String clientID = clientId == null || clientId.isEmpty() ||
global || pubId.endsWith("|global") ? null : clientId;
--- End diff --
Yep, as I mentioned on the JIRA/other PRs the lack of a Source during
unsubscribe is an unfortunate (but unavoidable) complexity of the JMS
subscription mapping, and the broker instead needs to look for the 'global'
hint in the link desired capabilities the JMS client sent when doing the 'null
source lookup' needed during unsubscribe.
Something like this is what I meant:
```
---
a/artemis-protocols/artemis-amqp-protocol/src/main/java/org/apache/activemq/artemis/protocol/amqp/proton/ProtonServerSenderContext.java
+++
b/artemis-protocols/artemis-amqp-protocol/src/main/java/org/apache/activemq/artemis/protocol/amqp/proton/ProtonServerSenderContext.java
@@ -68,6 +68,7 @@ import
org.apache.qpid.proton.amqp.transport.ReceiverSettleMode;
import org.apache.qpid.proton.amqp.transport.SenderSettleMode;
import org.apache.qpid.proton.engine.Delivery;
import org.apache.qpid.proton.engine.EndpointState;
+import org.apache.qpid.proton.engine.Link;
import org.apache.qpid.proton.engine.Sender;
import org.jboss.logging.Logger;
@@ -188,6 +189,8 @@ public class ProtonServerSenderContext extends
ProtonInitializable implements Pr
// subscription queue
String clientId = getClientId();
String pubId = sender.getName();
+ global = hasRemoteDesiredCapability(sender, GLOBAL);
+
queue = createQueueName(clientId, pubId, true, global, false);
QueueQueryResult result = sessionSPI.queueQuery(queue,
RoutingType.MULTICAST, false);
multicast = true;
@@ -720,6 +723,19 @@ public class ProtonServerSenderContext extends
ProtonInitializable implements Pr
}
}
+ private static boolean hasRemoteDesiredCapability(Link link, Symbol
capability) {
+ Symbol[] remoteDesiredCapabilities =
link.getRemoteDesiredCapabilities();
+ if (remoteDesiredCapabilities != null) {
+ for (Symbol cap : remoteDesiredCapabilities) {
+ if (capability.equals(cap)) {
+ return true;
+ }
+ }
+ }
+
+ return false;
+ }
+
private static boolean hasCapabilities(Symbol symbol, Source source) {
if (source != null) {
if (source.getCapabilities() != null) {
```
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---