'setFault() method in Message no longer exists
Hello I need to upgrade from java 8 to java 17 and also to the last version of apache camel and I have this piece of code that has the setFault method in it that no longer exists in the latest version of apache camel. Does anyone know what I can replace it with?
protected void process(Exchange exchange, RequestContext<?, ?> ctx, Exception e, AlarmType alarm) throws Exception {
int errorCode = getErrorCode(exchange);
ctx.setResponseErrorCode(errorCode);
Message message = exchange.getMessage();
message.setHeader(Exchange.HTTP_METHOD, HttpMethods.POST);
message.setHeader(Exchange.HTTP_PROTOCOL_VERSION, "1.1");
message.setHeader(Exchange.HTTP_RESPONSE_CODE, getErrorCode(exchange));
message.setHeader("httpReasonPhrase", getErrorMessage(exchange));
message.setBody(getErrorBody(exchange));
message.setFault(ctx.isCXF());
}
Solution 1:[1]
From Camel 3.x and onward ( Camel 2.x to 3.0 Migration Guide ):
The fault API has been removed from org.apache.camel.Message as it was only used for SOAP-WS fault message. The camel-cxf and camel-spring-ws components for SOAP-WS has been modified to support fault messages from their components. The option handleFault has also been removed and you now need to turn this on as endpoint or component option on camel-cxf or camel-spring-ws
So you should be safe to just remove this line.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | fn. |
