Maksym Brodin created AMQ-7407:
----------------------------------

             Summary: Partitioning by queue/topic chooses incorrect target
                 Key: AMQ-7407
                 URL: https://issues.apache.org/jira/browse/AMQ-7407
             Project: ActiveMQ
          Issue Type: Bug
            Reporter: Maksym Brodin


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]

 
{code:java}
// 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;
}
{code}



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

Reply via email to