[
https://issues.apache.org/jira/browse/AMQ-7407?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Jean-Baptiste Onofré resolved AMQ-7407.
---------------------------------------
Resolution: Fixed
> 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
> Assignee: Jean-Baptiste Onofré
> Priority: Major
> Fix For: 5.16.0, 5.15.12
>
> Time Spent: 20m
> Remaining Estimate: 0h
>
> 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)