if (logger.isDebugEnabled())
{
logger.debug("Looking up vm receiver for address: " + endpointUri.toString());
}
MessageReceiver receiver;
// If we have an exact match, use it
receiver = receivers.get(endpointUri.getAddress());
if (receiver != null)
{
if (logger.isDebugEnabled())
{
logger.debug("Found exact receiver match on endpointUri: " + endpointUri);
}
return receiver;
}
// otherwise check each one against a wildcard match
for (Iterator iterator = receivers.values().iterator(); iterator.hasNext();)
{
receiver = (MessageReceiver)iterator.next();
String filterAddress = receiver.getEndpointURI().getAddress();
WildcardFilter filter = new WildcardFilter(filterAddress);
if (filter.accept(endpointUri.getAddress()))
{
InboundEndpoint endpoint = receiver.getEndpoint();
EndpointURI newEndpointURI = new MuleEndpointURI(endpointUri, filterAddress);
receiver.setEndpoint(new DynamicURIInboundEndpoint(endpoint, newEndpointURI));
if (logger.isDebugEnabled())
{
logger.debug("Found receiver match on endpointUri: " + receiver.getEndpointURI()
+ " against " + endpointUri);
}
return receiver;
}
}