This commit is contained in:
Redkale
2020-06-28 19:28:56 +08:00
parent b618e0e884
commit 68d78a4aa4
2 changed files with 4 additions and 3 deletions

View File

@@ -85,7 +85,7 @@ public class HttpMessageProcessor implements MessageProcessor {
servlet.execute(request, response);
} catch (Exception ex) {
if (message.getResptopic() != null && !message.getResptopic().isEmpty()) {
HttpMessageResponse.finishHttpResult(message, callback, producer, message.getResptopic(), new HttpResult().status(500));
HttpMessageResponse.finishHttpResult(finest, message, callback, producer, message.getResptopic(), new HttpResult().status(500));
}
logger.log(Level.SEVERE, HttpMessageProcessor.class.getSimpleName() + " process error, message=" + message, ex);
} finally {

View File

@@ -49,13 +49,14 @@ public class HttpMessageResponse extends HttpResponse {
}
public void finishHttpResult(HttpResult result) {
finishHttpResult(this.message, this.callback, this.producer, message.getResptopic(), result);
finishHttpResult(this.finest, this.message, this.callback, this.producer, message.getResptopic(), result);
}
public static void finishHttpResult(MessageRecord msg, Runnable callback, MessageProducer producer, String resptopic, HttpResult result) {
public static void finishHttpResult(boolean finest, MessageRecord msg, Runnable callback, MessageProducer producer, String resptopic, HttpResult result) {
if (callback != null) callback.run();
if (resptopic == null || resptopic.isEmpty()) return;
ConvertType format = result.convert() == null ? null : result.convert().getFactory().getConvertType();
if (finest) producer.logger.log(Level.FINEST, "HttpMessageProcessor.process seqid=" + msg.getSeqid() + ", result: " + result);
byte[] content = HttpResultCoder.getInstance().encode(result);
producer.apply(new MessageRecord(msg.getSeqid(), format, resptopic, null, content));
}