[
https://issues.apache.org/jira/browse/ARTEMIS-5908?focusedWorklogId=1006904&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-1006904
]
ASF GitHub Bot logged work on ARTEMIS-5908:
-------------------------------------------
Author: ASF GitHub Bot
Created on: 24/Feb/26 14:38
Start Date: 24/Feb/26 14:38
Worklog Time Spent: 10m
Work Description: gemmellr commented on code in PR #6244:
URL: https://github.com/apache/artemis/pull/6244#discussion_r2847386173
##########
tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/amqp/connect/AMQPBridgeConfigurationReloadTest.java:
##########
@@ -152,6 +156,90 @@ public void
testBridgeConfigurationWithoutChangesIsIgnoredOnUpdate() throws Exce
}
}
+ @Test
+ @Timeout(20)
+ public void testBridgeConfigurationWithChangeedPropertiesIsUpdated() throws
Exception {
+ try (ProtonTestServer peer = new ProtonTestServer()) {
+ peer.expectSASLAnonymousConnect();
+ peer.expectOpen().respond();
+ peer.expectBegin().respond();
+ peer.start();
+
+ final URI remoteURI = peer.getServerURI();
+ logger.info("Test started, peer listening on: {}", remoteURI);
+
+ final AMQPBridgeAddressPolicyElement receiveFromAddress = new
AMQPBridgeAddressPolicyElement();
+ receiveFromAddress.setName("address-policy");
+ receiveFromAddress.addToIncludes(getTestName());
+ receiveFromAddress.addToExcludes("test.ignore.#");
+ receiveFromAddress.setPriority(1);
+
+ final AMQPBridgeBrokerConnectionElement element = new
AMQPBridgeBrokerConnectionElement();
+ element.setName(getTestName());
+ element.addBridgeFromAddressPolicy(receiveFromAddress);
+ element.addProperty(ADDRESS_RECEIVER_IDLE_TIMEOUT, 0);
+
+ final AMQPBrokerConnectConfiguration amqpConnection =
+ new AMQPBrokerConnectConfiguration(getTestName(), "tcp://" +
remoteURI.getHost() + ":" + remoteURI.getPort());
+ amqpConnection.setReconnectAttempts(0);// No reconnects
+ amqpConnection.addElement(element);
+
+ server.getConfiguration().addAMQPConnection(amqpConnection);
+ server.start();
+ server.addAddressInfo(new AddressInfo(SimpleString.of(getTestName()),
RoutingType.MULTICAST));
+
+ peer.waitForScriptToComplete(5, TimeUnit.SECONDS);
+ peer.expectAttach().ofReceiver()
+ .withName(allOf(containsString(getTestName()),
+ containsString("address-receiver"),
+ containsString("amqp-bridge"),
+
containsString(server.getNodeID().toString())))
+ .respond();
+ peer.expectFlow().withLinkCredit(1000);
+
+ final ConnectionFactory factory =
CFUtil.createConnectionFactory("AMQP", "tcp://localhost:" + AMQP_PORT);
+
+ try (Connection connection = factory.createConnection()) {
+ final Session session =
connection.createSession(Session.AUTO_ACKNOWLEDGE);
+ session.createConsumer(session.createTopic(getTestName()));
+
+ final ProtonProtocolManagerFactory protocolFactory =
(ProtonProtocolManagerFactory)
+ server.getRemotingService().getProtocolFactoryMap().get("AMQP");
+ assertNotNull(protocolFactory);
+
+ final AMQPBridgeAddressPolicyElement updatedReceiveFromAddress =
new AMQPBridgeAddressPolicyElement();
+ updatedReceiveFromAddress.setName("address-policy");
+ updatedReceiveFromAddress.addToIncludes(getTestName());
+ updatedReceiveFromAddress.addToExcludes("test.ignore.#");
+ updatedReceiveFromAddress.setPriority(1);
+
+ final AMQPBridgeBrokerConnectionElement updatedElement = new
AMQPBridgeBrokerConnectionElement();
+ updatedElement.setName(getTestName());
+
updatedElement.addBridgeFromAddressPolicy(updatedReceiveFromAddress);
+ updatedElement.addProperty(ADDRESS_RECEIVER_IDLE_TIMEOUT, 10);
+
+ final AMQPBrokerConnectConfiguration amqpConnectionUpdated =
+ new AMQPBrokerConnectConfiguration(getTestName(), "tcp://" +
remoteURI.getHost() + ":" + remoteURI.getPort());
+ amqpConnectionUpdated.setReconnectAttempts(0);// No reconnects
+ amqpConnectionUpdated.addElement(updatedElement);
+ amqpConnectionUpdated.parseURI();
+
+ server.getConfiguration().getAMQPConnection().clear();
+ server.getConfiguration().addAMQPConnection(amqpConnectionUpdated);
+
+ connection.start();
+
+ peer.waitForScriptToComplete(5, TimeUnit.SECONDS);
+ peer.expectConnectionToDrop(); // Configuration update triggers
connection close and restore.
+
+ protocolFactory.updateProtocolServices(server,
Collections.emptyList());
+
+ peer.waitForScriptToComplete(5, TimeUnit.SECONDS);
+ peer.close();
Review Comment:
If its dropping and restoring per earlier comment, shouldnt there be more
expectations for the restore? Is there a race to close the peer if not? Comment
could make things clearer either way.
##########
tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/amqp/connect/AMQPBridgeConfigurationReloadTest.java:
##########
@@ -152,6 +156,90 @@ public void
testBridgeConfigurationWithoutChangesIsIgnoredOnUpdate() throws Exce
}
}
+ @Test
+ @Timeout(20)
+ public void testBridgeConfigurationWithChangeedPropertiesIsUpdated() throws
Exception {
Review Comment:
```suggestion
public void testBridgeConfigurationWithChangedPropertiesIsUpdated()
throws Exception {
```
##########
tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/amqp/connect/AMQPBridgeConfigurationReloadTest.java:
##########
@@ -152,6 +156,90 @@ public void
testBridgeConfigurationWithoutChangesIsIgnoredOnUpdate() throws Exce
}
}
+ @Test
+ @Timeout(20)
+ public void testBridgeConfigurationWithChangeedPropertiesIsUpdated() throws
Exception {
+ try (ProtonTestServer peer = new ProtonTestServer()) {
+ peer.expectSASLAnonymousConnect();
+ peer.expectOpen().respond();
+ peer.expectBegin().respond();
+ peer.start();
+
+ final URI remoteURI = peer.getServerURI();
+ logger.info("Test started, peer listening on: {}", remoteURI);
+
+ final AMQPBridgeAddressPolicyElement receiveFromAddress = new
AMQPBridgeAddressPolicyElement();
+ receiveFromAddress.setName("address-policy");
+ receiveFromAddress.addToIncludes(getTestName());
+ receiveFromAddress.addToExcludes("test.ignore.#");
+ receiveFromAddress.setPriority(1);
+
+ final AMQPBridgeBrokerConnectionElement element = new
AMQPBridgeBrokerConnectionElement();
+ element.setName(getTestName());
+ element.addBridgeFromAddressPolicy(receiveFromAddress);
+ element.addProperty(ADDRESS_RECEIVER_IDLE_TIMEOUT, 0);
+
+ final AMQPBrokerConnectConfiguration amqpConnection =
+ new AMQPBrokerConnectConfiguration(getTestName(), "tcp://" +
remoteURI.getHost() + ":" + remoteURI.getPort());
+ amqpConnection.setReconnectAttempts(0);// No reconnects
+ amqpConnection.addElement(element);
+
+ server.getConfiguration().addAMQPConnection(amqpConnection);
+ server.start();
+ server.addAddressInfo(new AddressInfo(SimpleString.of(getTestName()),
RoutingType.MULTICAST));
+
+ peer.waitForScriptToComplete(5, TimeUnit.SECONDS);
+ peer.expectAttach().ofReceiver()
+ .withName(allOf(containsString(getTestName()),
+ containsString("address-receiver"),
+ containsString("amqp-bridge"),
+
containsString(server.getNodeID().toString())))
+ .respond();
+ peer.expectFlow().withLinkCredit(1000);
+
+ final ConnectionFactory factory =
CFUtil.createConnectionFactory("AMQP", "tcp://localhost:" + AMQP_PORT);
+
+ try (Connection connection = factory.createConnection()) {
+ final Session session =
connection.createSession(Session.AUTO_ACKNOWLEDGE);
+ session.createConsumer(session.createTopic(getTestName()));
+
+ final ProtonProtocolManagerFactory protocolFactory =
(ProtonProtocolManagerFactory)
+ server.getRemotingService().getProtocolFactoryMap().get("AMQP");
+ assertNotNull(protocolFactory);
+
+ final AMQPBridgeAddressPolicyElement updatedReceiveFromAddress =
new AMQPBridgeAddressPolicyElement();
+ updatedReceiveFromAddress.setName("address-policy");
+ updatedReceiveFromAddress.addToIncludes(getTestName());
+ updatedReceiveFromAddress.addToExcludes("test.ignore.#");
+ updatedReceiveFromAddress.setPriority(1);
+
+ final AMQPBridgeBrokerConnectionElement updatedElement = new
AMQPBridgeBrokerConnectionElement();
+ updatedElement.setName(getTestName());
+
updatedElement.addBridgeFromAddressPolicy(updatedReceiveFromAddress);
+ updatedElement.addProperty(ADDRESS_RECEIVER_IDLE_TIMEOUT, 10);
Review Comment:
This bit might be clearer later to have a comment on the changed property
Issue Time Tracking
-------------------
Worklog Id: (was: 1006904)
Time Spent: 20m (was: 10m)
> AMQP Federation and bridge connection configuration reload incomplete
> ---------------------------------------------------------------------
>
> Key: ARTEMIS-5908
> URL: https://issues.apache.org/jira/browse/ARTEMIS-5908
> Project: Artemis
> Issue Type: Bug
> Components: AMQP
> Affects Versions: 2.51.0
> Reporter: Timothy A. Bish
> Assignee: Timothy A. Bish
> Priority: Minor
> Labels: pull-request-available
> Fix For: 2.52.0
>
> Time Spent: 20m
> Remaining Estimate: 0h
>
> The comparison logic for AMQP federation and bridge policies is incomplete
> and can lead to missed configuration reloads if certain policy elements are
> updated. Remove and re-add works but some in place updates can be missed.
--
This message was sent by Atlassian Jira
(v8.20.10#820010)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]