ActivationSpec activationSpec = exchange.getActivationSpec();
if (activationSpec != null) {
EndpointResolver destinationResolver = activationSpec.getDestinationResolver();
if (destinationResolver != null) {
try {
EndpointFilter filter = createEndpointFilter(context, exchange);
theEndpoint = (InternalEndpoint) destinationResolver.resolveEndpoint(context, exchange, filter);
}
catch (JBIException e) {
throw new MessagingException("Failed to resolve endpoint: " + e, e);
}