1 year ago
#336825

Eljah
If the Camel Route crashes, is it removed from the Camel Context? If not, how can I check that it is no longer executed?
I have a readiness probe based on the fact that the number of Apache Camel routes loaded to the CamelContext
isn't decreasing. Am I right and can rely on this count as a scent of silently failed routes?
logger.info("Routes in context count:" + camelContext.getRoutes().size());
logger.info("Routes in context:" + camelContext.getRoutes().stream().map(Route::getId).collect(Collectors.joining(",")));
Integer camelContextRoutesCountLocal = camelContext.getRoutes().size();
if (camelContextRoutesCountLocal != camelContextRoutesCount.get()) {
logger.info("Previous routes count: "+camelContextRoutesCount.get());
logger.info("New routes count: "+camelContextRoutesCountLocal);
if (camelContextRoutesCountLocal < camelContextRoutesCount.get()) {
decreaseFlag = new AtomicBoolean(true);
}
camelContextRoutesCount = new AtomicInteger(camelContextRoutesCountLocal);
logger.error("New routes count isn't the same as was before");
//throw new Exception();
return ResponseEntity.status(500).build();
}
if (decreaseFlag.get()) {
logger.error("The number of loaded routes once was decreased");
return ResponseEntity.status(500).build();
//throw new Exception();
}
Is there some other way to make a readinessprobe to fail if some loaded route has been crashed and no longer serves the application?
java
apache-camel
readinessprobe
0 Answers
Your Answer