ServiceEndpoint endpoint = context.getEndpoint(serviceName, endpointName);
if (!filter.evaluate(endpoint, exchange)) {
endpoint = null;
}
if (endpoint == null && failIfUnavailable) {
throw new NoServiceEndpointAvailableException(serviceName, endpointName);
}
return endpoint;
}