for(int i = 0; i < paramResolvers.length; i++) {
try {
params[i] = paramResolvers[i].getParam(message);
} catch (MessageDeliverException e) {
throw new ActionProcessingException("Error resolving method parameter from ESB message.", e);
}
}
processResult = processMethod.invoke(bean, params);
} catch (IllegalArgumentException e) {
throw new ActionProcessingException("Bean Action '" + actionName + "' exception.", e);
} catch (IllegalAccessException e) {
throw new ActionProcessingException("Bean Action '" + actionName + "' exception.", e);
} catch (InvocationTargetException e) {
Throwable targetException = e.getTargetException();
if(targetException instanceof ActionProcessingException) {
throw (ActionProcessingException) targetException;
} else if (targetException instanceof RuntimeException) {
throw (RuntimeException) targetException;
} else {
throw new ActionProcessingException("Bean Action '" + actionName + "' exception.", targetException);
}
}
if(processResult == null && processMethod.getReturnType() != void.class) {
// Terminate the pipeline...
return null;
}
if(processResult instanceof Message) {
return (Message) processResult;
} else if(processResult != null) {
try {
payloadProxy.setPayload(message, processResult);
} catch (MessageDeliverException e) {
throw new ActionProcessingException("Error injecting 'out' payload into ESB message.", e);
}
}
return message;
}