[ 
https://issues.apache.org/jira/browse/ARTEMIS-5037?focusedWorklogId=946845&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-946845
 ]

ASF GitHub Bot logged work on ARTEMIS-5037:
-------------------------------------------

                Author: ASF GitHub Bot
            Created on: 05/Dec/24 10:48
            Start Date: 05/Dec/24 10:48
    Worklog Time Spent: 10m 
      Work Description: gemmellr commented on code in PR #5220:
URL: https://github.com/apache/activemq-artemis/pull/5220#discussion_r1871147900


##########
tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/amqp/connect/AMQPMirrorConnectionTest.java:
##########
@@ -229,6 +271,173 @@ public void testBrokerAddsAddressAndQueue() throws 
Exception {
       }
    }
 
+   @Override
+   protected void configureAMQPAcceptorParameters(Map<String, Object> params) {
+      params.put("amqpMinLargeMessageSize", 100 * 1024);
+   }
+
+   @Test
+   @Timeout(20)
+   public void testNoForwardBlocksMessagesAndControlsPropagation() throws 
Exception {
+      doTestNoForwardBlocksMessagesAndControlsPropagation(false, false);
+   }
+
+   @Test
+   @Timeout(20)
+   public void 
testNoForwardBlocksMessagesAndControlsPropagationWithTunneling() throws 
Exception {
+      doTestNoForwardBlocksMessagesAndControlsPropagation(true, false);
+   }
+
+   @Test
+   @Timeout(20)
+   public void testNoForwardBlocksLargeMessagesAndControlsPropagation() throws 
Exception {
+      doTestNoForwardBlocksMessagesAndControlsPropagation(false, true);
+   }
+
+   @Test
+   @Timeout(20)
+   public void 
testNoForwardBlocksLargeMessagesAndControlsPropagationWithTunneling() throws 
Exception {
+      doTestNoForwardBlocksMessagesAndControlsPropagation(true, true);
+   }
+
+   private void doTestNoForwardBlocksMessagesAndControlsPropagation(boolean 
tunneling, boolean longMessage) throws Exception {
+      final Map<String, Object> brokerProperties = new HashMap<>();
+      brokerProperties.put(AMQPMirrorControllerSource.BROKER_ID.toString(), 
"Test-Broker");
+
+      final String[] capabilities;
+      ArrayList<String> capabilitiesList = new ArrayList<>();
+      int messageFormat = 0;
+
+      capabilitiesList.add("amq.mirror");
+      if (tunneling) {
+         
capabilitiesList.add(AmqpSupport.CORE_MESSAGE_TUNNELING_SUPPORT.toString());
+         messageFormat = AMQP_TUNNELED_CORE_MESSAGE_FORMAT;
+      }
+      capabilities = capabilitiesList.toArray(new String[]{});
+
+      // Topology of the test: server -(noForward)-> server_2 -> peer_3
+      try (ProtonTestServer peer_3 = new ProtonTestServer()) {
+         peer_3.expectSASLPlainConnect("user", "pass", "PLAIN", "ANONYMOUS");
+         peer_3.expectOpen().respond();
+         peer_3.expectBegin().respond();
+         peer_3.expectAttach().ofSender()
+            .withName(Matchers.startsWith("$ACTIVEMQ_ARTEMIS_MIRROR"))
+            .withDesiredCapabilities(capabilities)
+            .respond()
+            .withOfferedCapabilities(capabilities)
+            .withPropertiesMap(brokerProperties);
+         peer_3.remoteFlow().withLinkCredit(10).queue();
+         peer_3.start();
+
+         final URI remoteURI = peer_3.getServerURI();
+         logger.info("Connect test started, peer listening on: {}", remoteURI);
+
+         final int AMQP_PORT_2 = BROKER_PORT_NUM + 1;
+         final ActiveMQServer server_2 = createServer(AMQP_PORT_2, false);
+         {
+            AMQPBrokerConnectConfiguration amqpConnection = new 
AMQPBrokerConnectConfiguration(getTestMethodName() + "toPeer3", "tcp://" + 
remoteURI.getHost() + ":" + remoteURI.getPort());
+            amqpConnection.setReconnectAttempts(0);// No reconnects
+            amqpConnection.setUser("user");
+            amqpConnection.setPassword("pass");
+            amqpConnection.addElement(new 
AMQPMirrorBrokerConnectionElement().addProperty(TUNNEL_CORE_MESSAGES, 
Boolean.toString(tunneling)).setQueueCreation(true).setAddressFilter(getQueueName()
 + ",sometest"));
+            server_2.getConfiguration().addAMQPConnection(amqpConnection);
+
+            amqpConnection = new 
AMQPBrokerConnectConfiguration(getTestMethodName() + "toServer", 
"tcp://localhost:" + BROKER_PORT_NUM);
+            amqpConnection.addElement(new 
AMQPMirrorBrokerConnectionElement().setAddressFilter(getQueueName()));
+            server_2.getConfiguration().addAMQPConnection(amqpConnection);
+         }
+
+         {
+            AMQPBrokerConnectConfiguration amqpConnection = new 
AMQPBrokerConnectConfiguration(getTestMethodName() + "toServer2", 
"tcp://localhost:" + AMQP_PORT_2).setRetryInterval(50);

Review Comment:
   That doesnt change the need for setting a retry limit though.
   
   Its probably better to set the interval as well when setting the limit 
actually, so that you fully specify and thus control the resulting 'timeout' as 
it were.





Issue Time Tracking
-------------------

    Worklog Id:     (was: 946845)
    Time Spent: 7h 10m  (was: 7h)

> AMQ Broker Mirroring: One to Many - avoid the infinite loop of the messages
> ---------------------------------------------------------------------------
>
>                 Key: ARTEMIS-5037
>                 URL: https://issues.apache.org/jira/browse/ARTEMIS-5037
>             Project: ActiveMQ Artemis
>          Issue Type: Bug
>            Reporter: Thomas Lavocat
>            Assignee: Thomas Lavocat
>            Priority: Major
>              Labels: pull-request-available
>          Time Spent: 7h 10m
>  Remaining Estimate: 0h
>
> AMQ Broker Mirroring: One to Many - avoid the infinite loop of the messages:
> if we have a->b-c->a..
> a message will circulate forever in the mirrors



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]
For further information, visit: https://activemq.apache.org/contact


Reply via email to