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

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

                Author: ASF GitHub Bot
            Created on: 20/Jul/21 11:57
            Start Date: 20/Jul/21 11:57
    Worklog Time Spent: 10m 
      Work Description: clebertsuconic commented on a change in pull request 
#3633:
URL: https://github.com/apache/activemq-artemis/pull/3633#discussion_r672492688



##########
File path: 
artemis-protocols/artemis-amqp-protocol/src/main/java/org/apache/activemq/artemis/protocol/amqp/proton/AMQPConnectionContext.java
##########
@@ -340,7 +344,19 @@ protected void remoteLinkOpened(Link link) throws 
Exception {
    }
 
    private boolean isReplicaTarget(Link link) {
-      return link != null && link.getTarget() != null && 
link.getTarget().getAddress() != null && 
link.getTarget().getAddress().equals(ProtonProtocolManager.MIRROR_ADDRESS);
+      boolean hasMirror = false;
+
+      Terminus terminus = (Terminus)link.getTarget();
+      if (terminus != null && terminus.getCapabilities() != null) {
+         for (Symbol s : terminus.getCapabilities()) {
+            if (s.equals(AMQPMirrorControllerSource.MIRROR_CAPABILITY)) {
+               hasMirror = true;
+               break;
+            }
+         }
+      }

Review comment:
       I'm still working on it

##########
File path: 
tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/amqp/AmqpClientTestSupport.java
##########
@@ -256,21 +262,46 @@ protected void configureAddressPolicy(ActiveMQServer 
server) {
 
    protected void createAddressAndQueues(ActiveMQServer server) throws 
Exception {
       // Default Queue
-      server.addAddressInfo(new 
AddressInfo(SimpleString.toSimpleString(getQueueName()), RoutingType.ANYCAST));
-      server.createQueue(new 
QueueConfiguration(getQueueName()).setRoutingType(RoutingType.ANYCAST));
+      try {
+         server.addAddressInfo(new 
AddressInfo(SimpleString.toSimpleString(getQueueName()), RoutingType.ANYCAST));
+      } catch (Throwable ignored) {
+      }

Review comment:
       Chained brokers will create the destinations on all the servers, however 
the mirror will also create the destinations.
   
   
   I will rather change the test.. this was just a hack for me to debug, I 
don't intend to leave this change on.

##########
File path: 
artemis-protocols/artemis-amqp-protocol/src/main/java/org/apache/activemq/artemis/protocol/amqp/proton/AMQPConnectionContext.java
##########
@@ -340,7 +344,19 @@ protected void remoteLinkOpened(Link link) throws 
Exception {
    }
 
    private boolean isReplicaTarget(Link link) {
-      return link != null && link.getTarget() != null && 
link.getTarget().getAddress() != null && 
link.getTarget().getAddress().equals(ProtonProtocolManager.MIRROR_ADDRESS);
+      boolean hasMirror = false;
+
+      Terminus terminus = (Terminus)link.getTarget();
+      if (terminus != null && terminus.getCapabilities() != null) {
+         for (Symbol s : terminus.getCapabilities()) {
+            if (s.equals(AMQPMirrorControllerSource.MIRROR_CAPABILITY)) {
+               hasMirror = true;
+               break;
+            }
+         }
+      }
+
+      return link != null && link.getTarget() != null && 
link.getTarget().getAddress() != null && hasMirror;

Review comment:
       you're right.. thanks

##########
File path: 
tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/amqp/AmqpClientTestSupport.java
##########
@@ -256,21 +262,46 @@ protected void configureAddressPolicy(ActiveMQServer 
server) {
 
    protected void createAddressAndQueues(ActiveMQServer server) throws 
Exception {
       // Default Queue
-      server.addAddressInfo(new 
AddressInfo(SimpleString.toSimpleString(getQueueName()), RoutingType.ANYCAST));
-      server.createQueue(new 
QueueConfiguration(getQueueName()).setRoutingType(RoutingType.ANYCAST));
+      try {
+         server.addAddressInfo(new 
AddressInfo(SimpleString.toSimpleString(getQueueName()), RoutingType.ANYCAST));
+      } catch (Throwable ignored) {
+      }

Review comment:
       I didn't intend to keep this change. it was just a hack for my 
investigation.
   
   The git commit is still Work in Progress but I removed it just to avoid 
confusion.
   
   I should have kept another branch with my backup away from the PR. sorry for 
the confusion.

##########
File path: 
artemis-protocols/artemis-amqp-protocol/src/main/java/org/apache/activemq/artemis/protocol/amqp/proton/AMQPConnectionContext.java
##########
@@ -340,7 +344,19 @@ protected void remoteLinkOpened(Link link) throws 
Exception {
    }
 
    private boolean isReplicaTarget(Link link) {
-      return link != null && link.getTarget() != null && 
link.getTarget().getAddress() != null && 
link.getTarget().getAddress().equals(ProtonProtocolManager.MIRROR_ADDRESS);
+      boolean hasMirror = false;
+
+      Terminus terminus = (Terminus)link.getTarget();

Review comment:
       ok, I changed this to the source, and pushed the commit... 
   
   thanks

##########
File path: 
tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/amqp/AmqpClientTestSupport.java
##########
@@ -256,21 +262,46 @@ protected void configureAddressPolicy(ActiveMQServer 
server) {
 
    protected void createAddressAndQueues(ActiveMQServer server) throws 
Exception {
       // Default Queue
-      server.addAddressInfo(new 
AddressInfo(SimpleString.toSimpleString(getQueueName()), RoutingType.ANYCAST));
-      server.createQueue(new 
QueueConfiguration(getQueueName()).setRoutingType(RoutingType.ANYCAST));
+      try {
+         server.addAddressInfo(new 
AddressInfo(SimpleString.toSimpleString(getQueueName()), RoutingType.ANYCAST));
+      } catch (Throwable ignored) {
+      }

Review comment:
       I fixed the test accordingly. Creates are now propagated accordingly. I 
actually changed the test to validate that a destination created on the first 
server ended up on the third as expected.

##########
File path: 
tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/amqp/journal/AmqpJournalLoadingTest.java
##########
@@ -45,23 +43,25 @@ public void durableMessageDataNotScannedOnRestartTest() 
throws Exception {
       server.stop();
       server.start();
 
-      final AMQPMessage amqpMessage;
-
       final Queue afterRestartQueueView = getProxyToQueue(getQueueName());
 
       Wait.assertTrue("All messages should arrive", () -> 
afterRestartQueueView.getMessageCount() == 1);
 
-      try (LinkedListIterator<MessageReference> iterator = 
afterRestartQueueView.iterator()) {
-         Assert.assertTrue(iterator.hasNext());
-         final MessageReference next = iterator.next();
-         Assert.assertNotNull(next);
-         Assert.assertFalse(iterator.hasNext());
-         final Message message = next.getMessage();
-         Assert.assertThat(message, Matchers.instanceOf(AMQPMessage.class));
-         amqpMessage = (AMQPMessage) message;
-         
Assert.assertEquals(AMQPMessage.MessageDataScanningStatus.RELOAD_PERSISTENCE, 
amqpMessage.getDataScanningStatus());
-         Assert.assertTrue(amqpMessage.isDurable());
-      }
+      final AtomicInteger foreachCount = new AtomicInteger(0);
+
+      ArrayList<AMQPMessage> messageReference = new ArrayList<>(1);
+
+      afterRestartQueueView.forEach((next) -> {

Review comment:
       You're right... thanks




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


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

    Worklog Id:     (was: 625343)
    Time Spent: 23h 20m  (was: 23h 10m)

> Enhance AMQP Mirror support with dual mirror
> --------------------------------------------
>
>                 Key: ARTEMIS-3243
>                 URL: https://issues.apache.org/jira/browse/ARTEMIS-3243
>             Project: ActiveMQ Artemis
>          Issue Type: Bug
>    Affects Versions: 2.17.0
>            Reporter: Clebert Suconic
>            Assignee: Clebert Suconic
>            Priority: Major
>             Fix For: 2.18.0
>
>          Time Spent: 23h 20m
>  Remaining Estimate: 0h
>
> at the current Mirror version, we can only mirror into a single direction.
> With this enhancement the two (or more brokers) would be connected to each 
> other, each one having its own ID, and each one would send updates to the 
> other broker.
> The outcome is that if you just transferred producers and consumers from one 
> broker into the other, the fallback would be automatic and simple. No need to 
> disable and enable mirror options.



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

Reply via email to