// NOTE: In case a dev ever change this rule, QueueImpl::unproposed is using this rule to determine if
// the binding belongs to its Queue before removing it
SimpleString fullID = groupId.concat(".").concat(routingName);
// see if there is already a response
Response resp = groupingGroupingHandler.getProposal(fullID, true);
if (resp == null)
{
// ok let's find the next binding to propose
Binding theBinding = getNextBinding(message, routingName, bindings);
if (theBinding == null)
{
continue;
}
resp = groupingGroupingHandler.propose(new Proposal(fullID, theBinding.getClusterName()));
if (resp == null)
{
HornetQServerLogger.LOGGER.debug("it got a timeout on propose, trying again, number of retries: " + tries);
// it timed out, so we will check it through routeAndcheckNull
theBinding = null;
}
// alternativeClusterName will be != null when by the time we looked at the cachedProposed,
// another thread already set the proposal, so we use the new alternativeclusterName that's set there
// if our proposal was declined find the correct binding to use
if (resp != null && resp.getAlternativeClusterName() != null)
{
theBinding = locateBinding(resp.getAlternativeClusterName(), bindings);
}
routeAndCheckNull(message, context, resp, theBinding, groupId, tries);
}
else
{
// ok, we need to find the binding and route it
Binding chosen = locateBinding(resp.getChosenClusterName(), bindings);
routeAndCheckNull(message, context, resp, chosen, groupId, tries);
}
}
}