ARTEMIS-3096 bridge config using wrong default conf-window-size

This commit is contained in:
Justin Bertram 2021-02-04 12:29:10 -06:00
parent c47122ea15
commit 15e3cdf409
3 changed files with 33 additions and 2 deletions

View File

@ -89,7 +89,7 @@ public final class BridgeConfiguration implements Serializable {
private boolean useDuplicateDetection = ActiveMQDefaultConfiguration.isDefaultBridgeDuplicateDetection();
private int confirmationWindowSize = ActiveMQClient.DEFAULT_CONFIRMATION_WINDOW_SIZE;
private int confirmationWindowSize = ActiveMQDefaultConfiguration.getDefaultBridgeConfirmationWindowSize();
// disable flow control
private int producerWindowSize = ActiveMQDefaultConfiguration.getDefaultBridgeProducerWindowSize();

View File

@ -97,7 +97,7 @@ public class BridgeConfigurationTest {
Assert.assertEquals("-1", jsonObject.get(BridgeConfiguration.RECONNECT_ATTEMPTS).toString());
Assert.assertEquals("10", jsonObject.get(BridgeConfiguration.RECONNECT_ATTEMPTS_ON_SAME_NODE).toString());
Assert.assertEquals("true", jsonObject.get(BridgeConfiguration.USE_DUPLICATE_DETECTION).toString());
Assert.assertEquals("-1", jsonObject.get(BridgeConfiguration.CONFIRMATION_WINDOW_SIZE).toString());
Assert.assertEquals("10485760", jsonObject.get(BridgeConfiguration.CONFIRMATION_WINDOW_SIZE).toString());
Assert.assertEquals("-1", jsonObject.get(BridgeConfiguration.PRODUCER_WINDOW_SIZE).toString());
Assert.assertEquals("30000", jsonObject.get(BridgeConfiguration.CLIENT_FAILURE_CHECK_PERIOD).toString());
Assert.assertEquals("2000", jsonObject.get(BridgeConfiguration.MAX_RETRY_INTERVAL).toString());

View File

@ -2011,6 +2011,37 @@ public class BridgeTest extends ActiveMQTestBase {
assertEquals(transformer, ((BridgeImpl) bridge).getTransformer());
}
@Test
public void testDefaultConfirmationWindowSize() throws Exception {
final SimpleString ADDRESS = new SimpleString("myAddress");
final SimpleString QUEUE = new SimpleString("myQueue");
final SimpleString FORWARDING_ADDRESS = new SimpleString("myForwardingAddress");
final SimpleString FORWARDING_QUEUE = new SimpleString("myForwardingQueue");
final String BRIDGE = "myBridge";
Configuration config = createDefaultConfig(0, isNetty()).addConnectorConfiguration("myConnector", new TransportConfiguration(getConnector()));
ActiveMQServer server = addServer(new ActiveMQServerImpl(config));
server.start();
server.waitForActivation(100, TimeUnit.MILLISECONDS);
server.createQueue(new QueueConfiguration(QUEUE).setAddress(ADDRESS).setRoutingType(RoutingType.ANYCAST).setDurable(false));
server.createQueue(new QueueConfiguration(FORWARDING_QUEUE).setAddress(FORWARDING_ADDRESS).setRoutingType(RoutingType.ANYCAST).setDurable(false));
server.deployBridge(new BridgeConfiguration()
.setName(BRIDGE)
.setQueueName(QUEUE.toString())
.setForwardingAddress(FORWARDING_ADDRESS.toString())
.setStaticConnectors(List.of("myConnector")));
// now we actually have to use the bridge to make sure it connected correctly
locator = addServerLocator(ActiveMQClient.createServerLocatorWithoutHA(new TransportConfiguration(getConnector())));
ClientSessionFactory sf = addSessionFactory(locator.createSessionFactory());
ClientSession session = addClientSession(sf.createSession(false, true, true));
ClientProducer producer = addClientProducer(session.createProducer(ADDRESS));
ClientConsumer consumer = addClientConsumer(session.createConsumer(FORWARDING_QUEUE));
session.start();
producer.send(session.createMessage(true));
Assert.assertNotNull(consumer.receive(200));
}
/**
* It will inspect the journal directly and determine if there are queues on this journal,
*