return walkToEndOfChain(filter.getNext());
}
@Override
public MessageBodyData routeMessageToService(MessageBodyData data) throws MessagingException {
RemotingMessage message = (RemotingMessage) data;
String destination = message.getDestination();
String operation = message.getOperation();
Object[] params = message.getParameters();
Service service = locateService(destination, operation, params);
Object response = null;
if (service == null) {
response = new ErrorMessage("Service was null.", destination, operation, params);
LogWriter.error(getClass(), response.toString());
} else {
try {
response = service.invoke();
} catch (Exception e) {
response = new ErrorMessage("Service invocation failed: " + e.getMessage(), destination, operation,
params);
LogWriter.error(getClass(), response.toString(), e);
}
}
RemoteResponseMessage ack = message.createResponse();
ack.setBody(response);
return ack;
}