This is an automated email from the ASF dual-hosted git repository.

mattrpav pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/activemq.git


The following commit(s) were added to refs/heads/main by this push:
     new 413dfa953 [AMQ-5137] make networkConnector 
decreaseNetworkConsumerPriority="true" the default (#771)
413dfa953 is described below

commit 413dfa953288dc7690af00b3b93d0f30a4625f6e
Author: Matt Pavlovich <[email protected]>
AuthorDate: Mon Mar 13 20:00:36 2023 -0600

    [AMQ-5137] make networkConnector decreaseNetworkConsumerPriority="true" the 
default (#771)
---
 .../network/NetworkBridgeConfiguration.java        |  10 +-
 .../network/MQTTNetworkOfBrokersFailoverTest.java  |   1 +
 .../network/NetworkConnectorDefaultsTest.java      | 111 +++++++++++++++++++++
 3 files changed, 113 insertions(+), 9 deletions(-)

diff --git 
a/activemq-broker/src/main/java/org/apache/activemq/network/NetworkBridgeConfiguration.java
 
b/activemq-broker/src/main/java/org/apache/activemq/network/NetworkBridgeConfiguration.java
index 018355c7b..37e88d0c0 100644
--- 
a/activemq-broker/src/main/java/org/apache/activemq/network/NetworkBridgeConfiguration.java
+++ 
b/activemq-broker/src/main/java/org/apache/activemq/network/NetworkBridgeConfiguration.java
@@ -39,7 +39,7 @@ public class NetworkBridgeConfiguration {
     private boolean dynamicOnly;
     private boolean syncDurableSubs;
     private boolean dispatchAsync = true;
-    private boolean decreaseNetworkConsumerPriority;
+    private boolean decreaseNetworkConsumerPriority = true;
     private int consumerPriorityBase = ConsumerInfo.NETWORK_CONSUMER_PRIORITY;
     private boolean duplex;
     private boolean bridgeTempDestinations = true;
@@ -586,14 +586,6 @@ public class NetworkBridgeConfiguration {
         this.bridgeFactory = bridgeFactory;
     }
 
-    /**
-     * This was a typo, so this is deprecated as of 5.13.1
-     */
-    @Deprecated
-    public boolean isUseVirtualDestSus() {
-        return useVirtualDestSubs;
-    }
-
     public void setUseVirtualDestSubs(
             boolean useVirtualDestSubs) {
         this.useVirtualDestSubs = useVirtualDestSubs;
diff --git 
a/activemq-unit-tests/src/test/java/org/apache/activemq/network/MQTTNetworkOfBrokersFailoverTest.java
 
b/activemq-unit-tests/src/test/java/org/apache/activemq/network/MQTTNetworkOfBrokersFailoverTest.java
index 928a7a636..229a46794 100644
--- 
a/activemq-unit-tests/src/test/java/org/apache/activemq/network/MQTTNetworkOfBrokersFailoverTest.java
+++ 
b/activemq-unit-tests/src/test/java/org/apache/activemq/network/MQTTNetworkOfBrokersFailoverTest.java
@@ -64,6 +64,7 @@ public class MQTTNetworkOfBrokersFailoverTest extends 
NetworkTestSupport {
 
         URI ncUri = new URI("static:(" + connector.getConnectUri().toString() 
+ ")");
         NetworkConnector nc = new DiscoveryNetworkConnector(ncUri);
+        nc.setDecreaseNetworkConsumerPriority(false);
         nc.setDuplex(true);
         remoteBroker.addNetworkConnector(nc);
         nc.start();
diff --git 
a/activemq-unit-tests/src/test/java/org/apache/activemq/network/NetworkConnectorDefaultsTest.java
 
b/activemq-unit-tests/src/test/java/org/apache/activemq/network/NetworkConnectorDefaultsTest.java
new file mode 100644
index 000000000..b6f27f7a4
--- /dev/null
+++ 
b/activemq-unit-tests/src/test/java/org/apache/activemq/network/NetworkConnectorDefaultsTest.java
@@ -0,0 +1,111 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.activemq.network;
+
+import junit.framework.TestCase;
+import org.apache.activemq.broker.BrokerService;
+import org.apache.activemq.command.ConsumerInfo;
+import org.junit.Test;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+public class NetworkConnectorDefaultsTest extends TestCase {
+    private static final Logger LOG = 
LoggerFactory.getLogger(NetworkConnectorDefaultsTest.class);
+
+    private static final String LOCAL_BROKER_TRANSPORT_URI = 
"tcp://localhost:61616";
+    private static final String REMOTE_BROKER_TRANSPORT_URI = 
"tcp://localhost:61617";
+    private static final String DESTINATION_NAME = "TEST.RECONNECT";
+
+    private BrokerService localBroker;
+    private BrokerService remoteBroker;
+
+    @Test
+    public void testDefaultValues() throws Exception {
+        LOG.info("testIsStarted is starting...");
+
+        LOG.info("Adding network connector...");
+        NetworkConnector nc = localBroker.addNetworkConnector("static:(" + 
REMOTE_BROKER_TRANSPORT_URI + ")");
+        nc.setName("NC1");
+
+        // Check values before calling .start()
+        assertEquals(Integer.valueOf(75), 
Integer.valueOf(nc.getAdvisoryAckPercentage()));
+        assertEquals(Integer.valueOf(0), 
Integer.valueOf(nc.getAdvisoryPrefetchSize()));
+        assertEquals(Integer.valueOf(ConsumerInfo.NETWORK_CONSUMER_PRIORITY), 
Integer.valueOf(nc.getConsumerPriorityBase()));
+        assertEquals(Integer.valueOf(1), Integer.valueOf(nc.getConsumerTTL()));
+        assertEquals(Long.valueOf(60 * 1000l), 
Long.valueOf(nc.getGcSweepTime()));
+        assertEquals(Integer.valueOf(1), Integer.valueOf(nc.getMessageTTL()));
+        assertEquals(Integer.valueOf(1), Integer.valueOf(nc.getNetworkTTL()));
+        assertEquals(Integer.valueOf(1000), 
Integer.valueOf(nc.getPrefetchSize()));
+        assertFalse(nc.isAdvisoryForFailedForward());
+        assertTrue(nc.isAlwaysSyncSend());
+        assertTrue(nc.isBridgeTempDestinations());
+        assertFalse(nc.isCheckDuplicateMessagesOnDuplex());
+        assertFalse(nc.isConduitNetworkQueueSubscriptions());
+        assertTrue(nc.isDecreaseNetworkConsumerPriority());
+        assertTrue(nc.isDispatchAsync());
+        assertFalse(nc.isDuplex());
+        assertFalse(nc.isDynamicOnly());
+        assertTrue(nc.isGcDestinationViews());
+        assertFalse(nc.isStaticBridge());
+        assertFalse(nc.isSuppressDuplicateQueueSubscriptions());
+        assertTrue(nc.isSuppressDuplicateTopicSubscriptions());
+        assertFalse(nc.isSyncDurableSubs());
+        assertTrue(nc.isUseBrokerNamesAsIdSeed());
+        assertFalse(nc.isUseCompression());
+        assertFalse(nc.isUseVirtualDestSubs());
+    }
+
+   
+
+    @Override
+    protected void setUp() throws Exception {
+        LOG.info("Setting up LocalBroker");
+        localBroker = new BrokerService();
+        localBroker.setBrokerName("LocalBroker");
+        localBroker.setUseJmx(false);
+        localBroker.setPersistent(false);
+        localBroker.setTransportConnectorURIs(new 
String[]{LOCAL_BROKER_TRANSPORT_URI});
+        localBroker.start();
+        localBroker.waitUntilStarted();
+
+        LOG.info("Setting up RemoteBroker");
+        remoteBroker = new BrokerService();
+        remoteBroker.setBrokerName("RemoteBroker");
+        remoteBroker.setUseJmx(false);
+        remoteBroker.setPersistent(false);
+        remoteBroker.setTransportConnectorURIs(new 
String[]{REMOTE_BROKER_TRANSPORT_URI});
+        remoteBroker.start();
+        remoteBroker.waitUntilStarted();
+    }
+
+    @Override
+    protected void tearDown() throws Exception {
+        if (localBroker.isStarted()) {
+            LOG.info("Stopping LocalBroker");
+            localBroker.stop();
+            localBroker.waitUntilStopped();
+            localBroker = null;
+        }
+
+        if (remoteBroker.isStarted()) {
+            LOG.info("Stopping RemoteBroker");
+            remoteBroker.stop();
+            remoteBroker.waitUntilStopped();
+            remoteBroker = null;
+        }
+    }
+}
\ No newline at end of file

Reply via email to