davsclaus commented on code in PR #26641:
URL: https://github.com/apache/camel/pull/26641#discussion_r4059803974
##########
core/camel-support/src/main/java/org/apache/camel/support/RouteWatcherReloadStrategy.java:
##########
@@ -385,10 +385,52 @@ protected void onRouteReload(Collection<Resource>
resources, boolean removeEvery
}
}
} catch (Exception e) {
+ // the routes that ran before were removed above and the new ones
failed to load: the app has no routes
+ // until the next successful reload. Restore the previous routes
now, without the failed resources, so a
+ // mistake in one file leaves the rest running (CAMEL-24860); the
failed file loads on its next save
+ restorePreviousRoutes(resources, e);
throw RuntimeCamelException.wrapRuntimeException(e);
}
}
+ /**
+ * Reloads the sources of the routes that ran before a failed reload,
without the resources that failed, so a
+ * mistake in one file does not leave the application without routes. The
previous set stays remembered, so the next
+ * successful reload of the failed file brings everything back together.
+ */
+ protected void restorePreviousRoutes(Collection<Resource> failed,
Exception cause) {
Review Comment:
Taken the first way in 3a18dc2c1989: the cause is now in the restore warning
("Reload failed due to: <message>. The previous routes were restored ..."), so
the recovery line names the load error it recovered from, and the parameter has
a job.
##########
core/camel-support/src/main/java/org/apache/camel/support/RouteWatcherReloadStrategy.java:
##########
@@ -385,10 +385,52 @@ protected void onRouteReload(Collection<Resource>
resources, boolean removeEvery
}
}
} catch (Exception e) {
+ // the routes that ran before were removed above and the new ones
failed to load: the app has no routes
+ // until the next successful reload. Restore the previous routes
now, without the failed resources, so a
+ // mistake in one file leaves the rest running (CAMEL-24860); the
failed file loads on its next save
+ restorePreviousRoutes(resources, e);
throw RuntimeCamelException.wrapRuntimeException(e);
}
}
+ /**
+ * Reloads the sources of the routes that ran before a failed reload,
without the resources that failed, so a
+ * mistake in one file does not leave the application without routes. The
previous set stays remembered, so the next
+ * successful reload of the failed file brings everything back together.
Review Comment:
Right, that sentence was from the first version before the clear() was added
(a formatter rewrap had swallowed my rewrite). Fixed in 3a18dc2c1989 with your
wording: after a successful restore the remembered set is cleared and the next
reload collects the sources from the running routes.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]