You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@qpid.apache.org by ro...@apache.org on 2017/01/12 14:31:54 UTC
qpid-jms git commit: QPIDJMS-220: add link capabilities during 'null
source lookup' hinting at it being a shared global sub,
when attempting unsubscribe on connections without a ClientID
Repository: qpid-jms
Updated Branches:
refs/heads/master bb91ce125 -> bb12ef788
QPIDJMS-220: add link capabilities during 'null source lookup' hinting at it being a shared global sub, when attempting unsubscribe on connections without a ClientID
Project: http://git-wip-us.apache.org/repos/asf/qpid-jms/repo
Commit: http://git-wip-us.apache.org/repos/asf/qpid-jms/commit/bb12ef78
Tree: http://git-wip-us.apache.org/repos/asf/qpid-jms/tree/bb12ef78
Diff: http://git-wip-us.apache.org/repos/asf/qpid-jms/diff/bb12ef78
Branch: refs/heads/master
Commit: bb12ef7883f1f85e6a0f4786339b448366397ef0
Parents: bb91ce1
Author: Robert Gemmell <ro...@apache.org>
Authored: Thu Jan 12 14:30:52 2017 +0000
Committer: Robert Gemmell <ro...@apache.org>
Committed: Thu Jan 12 14:30:52 2017 +0000
----------------------------------------------------------------------
.../jms/provider/amqp/AmqpConnectionSession.java | 10 +++++++++-
.../qpid/jms/test/testpeer/TestAmqpPeer.java | 18 ++++++++++++++++--
2 files changed, 25 insertions(+), 3 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/qpid-jms/blob/bb12ef78/qpid-jms-client/src/main/java/org/apache/qpid/jms/provider/amqp/AmqpConnectionSession.java
----------------------------------------------------------------------
diff --git a/qpid-jms-client/src/main/java/org/apache/qpid/jms/provider/amqp/AmqpConnectionSession.java b/qpid-jms-client/src/main/java/org/apache/qpid/jms/provider/amqp/AmqpConnectionSession.java
index 3f25164..78ca63a 100644
--- a/qpid-jms-client/src/main/java/org/apache/qpid/jms/provider/amqp/AmqpConnectionSession.java
+++ b/qpid-jms-client/src/main/java/org/apache/qpid/jms/provider/amqp/AmqpConnectionSession.java
@@ -28,6 +28,7 @@ import org.apache.qpid.jms.provider.AsyncResult;
import org.apache.qpid.jms.provider.NoOpAsyncResult;
import org.apache.qpid.jms.provider.WrappedAsyncResult;
import org.apache.qpid.jms.provider.amqp.builders.AmqpResourceBuilder;
+import org.apache.qpid.proton.amqp.Symbol;
import org.apache.qpid.proton.amqp.messaging.Target;
import org.apache.qpid.proton.amqp.transport.ReceiverSettleMode;
import org.apache.qpid.proton.amqp.transport.SenderSettleMode;
@@ -104,10 +105,11 @@ public class AmqpConnectionSession extends AmqpSession {
private final class DurableSubscriptionReattachBuilder extends AmqpResourceBuilder<DurableSubscriptionReattach, AmqpSession, JmsSessionInfo, Receiver> {
private final String linkName;
+ private final boolean hasClientID;
public DurableSubscriptionReattachBuilder(AmqpSession parent, JmsSessionInfo resourceInfo, String linkName) {
super(parent, resourceInfo);
-
+ this.hasClientID = parent.getConnection().getResourceInfo().isExplicitClientID();
this.linkName = linkName;
}
@@ -118,6 +120,12 @@ public class AmqpConnectionSession extends AmqpSession {
receiver.setSenderSettleMode(SenderSettleMode.UNSETTLED);
receiver.setReceiverSettleMode(ReceiverSettleMode.FIRST);
+ if(!hasClientID) {
+ // We are trying to unsubscribe a 'global' shared subs using a 'null source lookup', add link
+ // desired capabilities as hints to the peer to consider this when trying to attach the link.
+ receiver.setDesiredCapabilities(new Symbol[] { AmqpSupport.SHARED, AmqpSupport.GLOBAL });
+ }
+
return receiver;
}
http://git-wip-us.apache.org/repos/asf/qpid-jms/blob/bb12ef78/qpid-jms-client/src/test/java/org/apache/qpid/jms/test/testpeer/TestAmqpPeer.java
----------------------------------------------------------------------
diff --git a/qpid-jms-client/src/test/java/org/apache/qpid/jms/test/testpeer/TestAmqpPeer.java b/qpid-jms-client/src/test/java/org/apache/qpid/jms/test/testpeer/TestAmqpPeer.java
index 89370e0..0176c2d 100644
--- a/qpid-jms-client/src/test/java/org/apache/qpid/jms/test/testpeer/TestAmqpPeer.java
+++ b/qpid-jms-client/src/test/java/org/apache/qpid/jms/test/testpeer/TestAmqpPeer.java
@@ -20,6 +20,8 @@ package org.apache.qpid.jms.test.testpeer;
import static org.apache.qpid.jms.provider.amqp.AmqpSupport.DYNAMIC_NODE_LIFETIME_POLICY;
import static org.apache.qpid.jms.provider.amqp.AmqpSupport.SHARED_SUBS;
+import static org.apache.qpid.jms.provider.amqp.AmqpSupport.SHARED;
+import static org.apache.qpid.jms.provider.amqp.AmqpSupport.GLOBAL;
import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.Matchers.arrayContaining;
import static org.hamcrest.Matchers.equalTo;
@@ -29,6 +31,7 @@ import static org.hamcrest.Matchers.lessThan;
import static org.hamcrest.Matchers.notNullValue;
import static org.hamcrest.Matchers.nullValue;
+import java.beans.DesignMode;
import java.io.IOException;
import java.net.Socket;
import java.util.ArrayList;
@@ -1311,11 +1314,22 @@ public class TestAmqpPeer implements AutoCloseable
responseSourceOverride.setExpiryPolicy(TerminusExpiryPolicy.NEVER);
if(shared) {
- responseSourceOverride.setCapabilities(new Symbol[]{SHARED_SUBS});
+ if(hasClientID) {
+ responseSourceOverride.setCapabilities(new Symbol[]{SHARED});
+ } else {
+ responseSourceOverride.setCapabilities(new Symbol[]{SHARED, GLOBAL});
+ }
}
}
- expectReceiverAttach(linkNameMatcher, nullSourceMatcher, false, failLookup, false, false, errorType, errorMessage, responseSourceOverride, null, null);
+ // If we don't have a ClientID, expect link capabilities to hint that we are trying
+ // to reattach to a 'global' shared subscription.
+ Matcher<?> linkDesiredCapabilitiesMatcher = null;
+ if(!hasClientID) {
+ linkDesiredCapabilitiesMatcher = arrayContaining(new Symbol[] { SHARED, GLOBAL });
+ }
+
+ expectReceiverAttach(linkNameMatcher, nullSourceMatcher, false, failLookup, false, false, errorType, errorMessage, responseSourceOverride, linkDesiredCapabilitiesMatcher, null);
}
public void expectDetach(boolean expectClosed, boolean sendResponse, boolean replyClosed)
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@qpid.apache.org
For additional commands, e-mail: commits-help@qpid.apache.org