Skip to content

Commit

Permalink
fix: make error processing asynchronous (#311)
Browse files Browse the repository at this point in the history
Signed-off-by: Ruben Romero Montes <rromerom@redhat.com>
  • Loading branch information
ruromero authored Mar 14, 2024
1 parent 15c5ded commit 9fbcc73
Showing 1 changed file with 3 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -256,16 +256,16 @@ public void configure() {
.routeId("analyticsTrackAnalysis")
.process(analytics::trackAnalysis);

from(seda("processFailedRequests"))
from(seda("processFailedRequests")).setExchangePattern(ExchangePattern.InOnly)
.routeId("processFailedRequests")
.setHeader(Constants.EXHORT_REQUEST_ID_HEADER, exchangeProperty(Constants.EXHORT_REQUEST_ID_HEADER))
.process(monitoringProcessor::processServerError);

from(direct("processInternalError"))
.routeId("processInternalError")
.log(LoggingLevel.ERROR, "${exception.stacktrace}")
.to(seda("processFailedRequests"))
.to(seda("processFailedRequests").waitForTaskToComplete(WaitForTaskToComplete.Never))
.setBody().simple("${exception.message}")
.setHeader(Constants.EXHORT_REQUEST_ID_HEADER, exchangeProperty(Constants.EXHORT_REQUEST_ID_HEADER))
.setHeader(Exchange.HTTP_RESPONSE_CODE, constant(Status.INTERNAL_SERVER_ERROR.getStatusCode()))
.setHeader(Exchange.CONTENT_TYPE, constant(MediaType.TEXT_PLAIN));

Expand Down

0 comments on commit 9fbcc73

Please sign in to comment.