You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@activemq.apache.org by cl...@apache.org on 2018/08/26 22:25:54 UTC
[1/2] activemq-artemis git commit: This closes #2267
Repository: activemq-artemis
Updated Branches:
refs/heads/master f8140b91d -> e02009055
This closes #2267
Project: http://git-wip-us.apache.org/repos/asf/activemq-artemis/repo
Commit: http://git-wip-us.apache.org/repos/asf/activemq-artemis/commit/e0200905
Tree: http://git-wip-us.apache.org/repos/asf/activemq-artemis/tree/e0200905
Diff: http://git-wip-us.apache.org/repos/asf/activemq-artemis/diff/e0200905
Branch: refs/heads/master
Commit: e020090551baf1cff3f374e86d7108aad9f8fb6f
Parents: f8140b9 87f393e
Author: Clebert Suconic <cl...@apache.org>
Authored: Sun Aug 26 18:25:47 2018 -0400
Committer: Clebert Suconic <cl...@apache.org>
Committed: Sun Aug 26 18:25:47 2018 -0400
----------------------------------------------------------------------
.../core/client/impl/ClientSessionImpl.java | 4 +--
.../core/server/impl/ActiveMQServerImpl.java | 13 +++++----
.../client/ConsumerWindowSizeTest.java | 30 ++++++++++++++++++++
3 files changed, 40 insertions(+), 7 deletions(-)
----------------------------------------------------------------------
[2/2] activemq-artemis git commit: ARTEMIS-2052 - Fix
defaultConsumerWindowSize negotiation
Posted by cl...@apache.org.
ARTEMIS-2052 - Fix defaultConsumerWindowSize negotiation
First, QueueQuery should use address name for address settings
The name used for looking up address settings for a queue now uses the
address name if there is a local queue binding
Second, make sure sent credits to the server is the correct value
Project: http://git-wip-us.apache.org/repos/asf/activemq-artemis/repo
Commit: http://git-wip-us.apache.org/repos/asf/activemq-artemis/commit/87f393e5
Tree: http://git-wip-us.apache.org/repos/asf/activemq-artemis/tree/87f393e5
Diff: http://git-wip-us.apache.org/repos/asf/activemq-artemis/diff/87f393e5
Branch: refs/heads/master
Commit: 87f393e5971d1e7bb39e4cbf7f6aba02f291045a
Parents: f8140b9
Author: Christopher L. Shannon (cshannon) <ch...@gmail.com>
Authored: Fri Aug 24 11:02:22 2018 -0400
Committer: Clebert Suconic <cl...@apache.org>
Committed: Sun Aug 26 18:25:47 2018 -0400
----------------------------------------------------------------------
.../core/client/impl/ClientSessionImpl.java | 4 +--
.../core/server/impl/ActiveMQServerImpl.java | 13 +++++----
.../client/ConsumerWindowSizeTest.java | 30 ++++++++++++++++++++
3 files changed, 40 insertions(+), 7 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/87f393e5/artemis-core-client/src/main/java/org/apache/activemq/artemis/core/client/impl/ClientSessionImpl.java
----------------------------------------------------------------------
diff --git a/artemis-core-client/src/main/java/org/apache/activemq/artemis/core/client/impl/ClientSessionImpl.java b/artemis-core-client/src/main/java/org/apache/activemq/artemis/core/client/impl/ClientSessionImpl.java
index 711d7ce..f1ef526 100644
--- a/artemis-core-client/src/main/java/org/apache/activemq/artemis/core/client/impl/ClientSessionImpl.java
+++ b/artemis-core-client/src/main/java/org/apache/activemq/artemis/core/client/impl/ClientSessionImpl.java
@@ -1887,8 +1887,8 @@ public final class ClientSessionImpl implements ClientSessionInternal, FailureLi
// consumer
// TODO: this could semantically change on other servers. I know for instance on stomp this is just an ignore
- if (windowSize != 0) {
- sessionContext.sendConsumerCredits(consumer, windowSize);
+ if (consumer.getClientWindowSize() != 0) {
+ sessionContext.sendConsumerCredits(consumer, consumer.getClientWindowSize());
}
return consumer;
http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/87f393e5/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/impl/ActiveMQServerImpl.java
----------------------------------------------------------------------
diff --git a/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/impl/ActiveMQServerImpl.java b/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/impl/ActiveMQServerImpl.java
index 4acc77b..054006b 100644
--- a/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/impl/ActiveMQServerImpl.java
+++ b/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/impl/ActiveMQServerImpl.java
@@ -876,7 +876,14 @@ public class ActiveMQServerImpl implements ActiveMQServer {
throw ActiveMQMessageBundle.BUNDLE.queueNameIsNull();
}
- final AddressSettings addressSettings = getAddressSettingsRepository().getMatch(name.toString());
+ QueueQueryResult response;
+
+ Binding binding = getPostOffice().getBinding(name);
+
+ final SimpleString addressName = binding != null && binding.getType() == BindingType.LOCAL_QUEUE
+ ? binding.getAddress() : name;
+
+ final AddressSettings addressSettings = getAddressSettingsRepository().getMatch(addressName.toString());
boolean autoCreateQueues = addressSettings.isAutoCreateQueues();
boolean defaultPurgeOnNoConsumers = addressSettings.isDefaultPurgeOnNoConsumers();
@@ -885,10 +892,6 @@ public class ActiveMQServerImpl implements ActiveMQServer {
boolean defaultLastValueQueue = addressSettings.isDefaultLastValueQueue();
int defaultConsumerWindowSize = addressSettings.getDefaultConsumerWindowSize();
- QueueQueryResult response;
-
- Binding binding = getPostOffice().getBinding(name);
-
SimpleString managementAddress = getManagementService() != null ? getManagementService().getManagementAddress() : null;
if (binding != null && binding.getType() == BindingType.LOCAL_QUEUE) {
http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/87f393e5/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/client/ConsumerWindowSizeTest.java
----------------------------------------------------------------------
diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/client/ConsumerWindowSizeTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/client/ConsumerWindowSizeTest.java
index d4298e5..e58f4bc 100644
--- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/client/ConsumerWindowSizeTest.java
+++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/client/ConsumerWindowSizeTest.java
@@ -36,15 +36,18 @@ import org.apache.activemq.artemis.api.core.client.MessageHandler;
import org.apache.activemq.artemis.api.core.client.ServerLocator;
import org.apache.activemq.artemis.core.client.impl.ClientConsumerImpl;
import org.apache.activemq.artemis.core.client.impl.ClientConsumerInternal;
+import org.apache.activemq.artemis.core.client.impl.ClientSessionImpl;
import org.apache.activemq.artemis.core.postoffice.Binding;
import org.apache.activemq.artemis.core.postoffice.Bindings;
import org.apache.activemq.artemis.core.postoffice.QueueBinding;
import org.apache.activemq.artemis.core.server.ActiveMQServer;
import org.apache.activemq.artemis.core.server.Consumer;
+import org.apache.activemq.artemis.core.server.ServerSession;
import org.apache.activemq.artemis.core.server.impl.ServerConsumerImpl;
import org.apache.activemq.artemis.core.settings.impl.AddressSettings;
import org.apache.activemq.artemis.tests.integration.IntegrationTestLogger;
import org.apache.activemq.artemis.tests.util.ActiveMQTestBase;
+import org.apache.activemq.artemis.tests.util.Wait;
import org.junit.Assert;
import org.junit.Before;
import org.junit.Ignore;
@@ -1428,6 +1431,33 @@ public class ConsumerWindowSizeTest extends ActiveMQTestBase {
}
@Test
+ public void testConsumerWindowSizeAddressSettingsDifferentAddressAndQueueName() throws Exception {
+ ActiveMQServer messagingService = createServer(false, isNetty());
+
+ final int defaultConsumerWindowSize = 1024 * 5;
+ final AddressSettings settings = new AddressSettings();
+ settings.setDefaultConsumerWindowSize(defaultConsumerWindowSize);
+ messagingService.getConfiguration()
+ .getAddressesSettings().put(addressA.toString(), settings);
+
+ messagingService.start();
+ messagingService.createQueue(addressA, RoutingType.ANYCAST, queueA, null, true, false);
+
+ ClientSessionFactory cf = createSessionFactory(locator);
+ ClientSession session = cf.createSession(false, true, true);
+ ClientConsumerImpl consumer = (ClientConsumerImpl) session.createConsumer(queueA);
+
+ session.start();
+
+ assertEquals(defaultConsumerWindowSize / 2, consumer.getClientWindowSize());
+
+ ServerSession ss = messagingService.getSessionByID(((ClientSessionImpl)session).getName());
+ ServerConsumerImpl cons = (ServerConsumerImpl) ss.locateConsumer(consumer.getConsumerContext().getId());
+
+ assertTrue(Wait.waitFor(() -> cons.getAvailableCredits().get() == consumer.getClientWindowSize(), 5000, 500));
+ }
+
+ @Test
public void testConsumerWindowSizeAddressSettingsWildCard() throws Exception {
ActiveMQServer messagingService = createServer(false, isNetty());