Uploaded image for project: 'ActiveMQ Classic'
  1. ActiveMQ Classic
  2. AMQ-7407

Partitioning by queue/topic chooses incorrect target

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Major
    • Resolution: Fixed
    • None
    • 5.16.0, 5.15.12
    • None
    • None

    Description

      This code always returns the latest target, instead of the best target (with the largest score)

      https://github.com/apache/activemq/blob/master/activemq-partition/src/main/java/org/apache/activemq/partition/PartitionBroker.java#L251

       

      // The target with largest score wins..            
      if( !targetScores.isEmpty() ) {                
         Target bestTarget = null;                
         int bestScore=0;                
         for (Map.Entry<Target, Score> entry : targetScores.entrySet()) {
           if( entry.getValue().value > bestScore ) {
              bestTarget = entry.getKey();                    
           }
         }
         return bestTarget;
      }
      

      Attachments

        Issue Links

          Activity

            People

              jbonofre Jean-Baptiste Onofré
              mbrodin Maksym Brodin
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Time Tracking

                  Estimated:
                  Original Estimate - Not Specified
                  Not Specified
                  Remaining:
                  Remaining Estimate - 0h
                  0h
                  Logged:
                  Time Spent - 20m
                  20m