We are having akka - camel - netty environment, while communicating with 
the host, akka default dispacher sends multiple requests to the host.
For example akka-default-dispacher-1 sends two requests Request1 and 
Request2.

The Problem: The host is a standard banking service provider and sends 500 
status code when it wants to send error response to the client along with 
the SOAP response message.

The response is then interpreted in the following fashion:
if (errorCause instanceof NettyHttpOperationFailedException) {
NettyHttpOperationFailedException exception = 
(NettyHttpOperationFailedException) error.getCause();
if (exception != null) {
Integer statusCode = exception.getStatusCode();
if (statusCode != null && statusCode == 500) {
errorFlag = true;
HttpResponse httpResponse = (HttpResponse) exception.getResponse();
if (httpResponse != null) {
ChannelBuffer responseBuffer = httpResponse.getContent();
final byte[] body = responseBuffer.array();
String errorBody = new String(body);
}
}
}
}

*When host responds with http status 500 for Request1, netty supposedly 
closes the channel and the response for Request2 is not collected.*

As a solution to this we found two methods to override this behaviour:
1. Set the throwExceptionOnFailure to false (true by default), so that 
netty does not do any error handling and response for Request2 is captured.
2.Set okStatusCodeRange=200-500, so that 500 response is not considered as 
error response and netty error handling for 500 is supressed.

However, both the above approaches have their own flaws, for instance if we 
receive http response 400 or 404 or 405 for approach (2), they will be 
considered as good responses and will not be handled.

Desired approach: Netty should not close channel when it receives 500 
response Or There should be a provision to suppress specific http response 
code and not the entire range.
Or any other approach or configuration that can done to resolve the above 
issue.


-- 
You received this message because you are subscribed to the Google Groups 
"Netty discussions" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/netty/c6b6d720-f883-413d-b10d-1dafe7b2a21c%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to