You are viewing a plain text version of this content. The canonical link for it is here.
Posted to gitbox@activemq.apache.org by GitBox <gi...@apache.org> on 2021/07/01 02:16:14 UTC

[GitHub] [activemq-artemis] clebertsuconic commented on a change in pull request #3633: ARTEMIS-3243 Improve Mirror with dual mirror

clebertsuconic commented on a change in pull request #3633:
URL: https://github.com/apache/activemq-artemis/pull/3633#discussion_r661924025



##########
File path: artemis-protocols/artemis-amqp-protocol/src/main/java/org/apache/activemq/artemis/protocol/amqp/connect/mirror/AMQPMirrorControllerSource.java
##########
@@ -202,8 +241,35 @@ private static Properties getProperties(Message message) {
 
    @Override
    public void postAcknowledge(MessageReference ref, AckReason reason) throws Exception {
+
+      MirrorController targetController = getControllerTarget();
+
+      if (targetController != null || ref.getQueue() != null && (ref.getQueue().isInternalQueue() || ref.getQueue().isMirrorController())) {
+         if (logger.isTraceEnabled()) {
+            logger.trace(server + " rejecting postAcknowledge queue=" + ref.getQueue().getName() + ", ref=" + ref + " to avoid infinite loop with the mirror (reflection)");
+         }
+         return;
+      }
+
+      if (logger.isTraceEnabled()) {
+         logger.trace(server + " postAcknowledge " + ref);
+      }
+
       if (acks && !ref.getQueue().isMirrorController()) { // we don't call postACK on snfqueues, otherwise we would get infinite loop because of this feedback
-         Message message = createMessage(ref.getQueue().getAddress(), ref.getQueue().getName(), POST_ACK, ref.getMessage().getMessageID());
+         Long internalIDObject = (Long)ref.getMessage().getBrokerProperty(INTERNAL_ID_EXTRA_PROPERTY);
+         long internalID;
+         if (internalIDObject == null) {
+            internalID = ByteUtil.mixByteAndLong(localMirrorId, ref.getMessageID());
+         } else {
+            internalID = internalIDObject.longValue();
+            if (logger.isTraceEnabled()) {
+               logger.trace("server " + server + " acking message " + ref);
+            }
+         }
+         if (logger.isTraceEnabled()) {
+            logger.trace(server + " sending ack message from server " + ByteUtil.getFirstByte(internalID) + " with messageID=" + ByteUtil.removeFirstByte(internalID));
+         }

Review comment:
       I actually got the tests fixed.. I will spend some time cleaning up tomorrow.
   
   but the mixed IDs are gone now.




-- 
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: gitbox-unsubscribe@activemq.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org