오류 예외 메시지에서 메시지를 설정할 수 있습니다. (ActionProcessingFaultException)
예 :
public Message process(Message message) throws ActionProcessingException {
try {
Object obj = payloadProxy.getPayload(message);
String value = "";
if(obj instanceof String) {
value = (String) obj;
} else if(obj instanceof byte[]) {
value = new String((byte[])obj);
}
RouteRequest req = gson.fromJson(value, RouteRequest.class);
if(req == null) {
logger.warn("Invalid JSON Request to Solve Service. "+value);
throw new ActionProcessingException("Invalid JSON Request to Solve Service.");
}
payloadProxy.setPayload(message, req);
} catch (MessageDeliverException e) {
logger.error("Error handling with payload", e);
throw new ActionProcessingException("Error handling with payload", e);
} catch (Exception e) {
String htmlHelp = "<html><body><h1>Bad Format</h1></body></html>";
message.getBody().add(htmlHelp);
throw new ActionProcessingFaultException(message, "Error converting Json Object.");
}
return message;
}
하나 개 더 추가 : 나는 @OnException 방법에 ESB 메시지를 수정하는 시도했지만 실패했다. –