This is an automated email from the ASF dual-hosted git repository. davsclaus pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/camel.git
The following commit(s) were added to refs/heads/master by this push: new 4cefa1a CAMEL-12253: Add restart action to controlbus 4cefa1a is described below commit 4cefa1a095b1e00804d094dfcf2e6519198de11b Author: Claus Ibsen <claus.ib...@gmail.com> AuthorDate: Sat Feb 10 15:46:02 2018 +0100 CAMEL-12253: Add restart action to controlbus --- .../component/controlbus/ControlBusProducer.java | 19 ++++++++++++++----- .../controlbus/ControlBusRestartRouteTest.java | 2 +- 2 files changed, 15 insertions(+), 6 deletions(-) diff --git a/camel-core/src/main/java/org/apache/camel/component/controlbus/ControlBusProducer.java b/camel-core/src/main/java/org/apache/camel/component/controlbus/ControlBusProducer.java index c3d5bf5..90333fb 100644 --- a/camel-core/src/main/java/org/apache/camel/component/controlbus/ControlBusProducer.java +++ b/camel-core/src/main/java/org/apache/camel/component/controlbus/ControlBusProducer.java @@ -156,29 +156,38 @@ public class ControlBusProducer extends DefaultAsyncProducer { try { if ("start".equals(action)) { + log.debug("Starting route: {}", id); getEndpoint().getCamelContext().startRoute(id); } else if ("stop".equals(action)) { + log.debug("Stopping route: {}", id); getEndpoint().getCamelContext().stopRoute(id); } else if ("suspend".equals(action)) { + log.debug("Suspending route: {}", id); getEndpoint().getCamelContext().suspendRoute(id); } else if ("resume".equals(action)) { + log.debug("Resuming route: {}", id); getEndpoint().getCamelContext().resumeRoute(id); } else if ("restart".equals(action)) { + log.debug("Restarting route: {}", id); getEndpoint().getCamelContext().stopRoute(id); int delay = getEndpoint().getRestartDelay(); - try { - log.debug("Sleeping {} ms before starting route"); - Thread.sleep(delay); - } catch (InterruptedException e) { - // ignore + if (delay > 0) { + try { + log.debug("Sleeping {} ms before starting route: {}", delay, id); + Thread.sleep(delay); + } catch (InterruptedException e) { + // ignore + } } getEndpoint().getCamelContext().startRoute(id); } else if ("status".equals(action)) { + log.debug("Route status: {}", id); ServiceStatus status = getEndpoint().getCamelContext().getRouteStatus(id); if (status != null) { result = status.name(); } } else if ("stats".equals(action)) { + log.debug("Route stats: {}", id); // camel context or per route String name = getEndpoint().getCamelContext().getManagementName(); diff --git a/camel-core/src/test/java/org/apache/camel/component/controlbus/ControlBusRestartRouteTest.java b/camel-core/src/test/java/org/apache/camel/component/controlbus/ControlBusRestartRouteTest.java index 20c29a3..28e9a83 100644 --- a/camel-core/src/test/java/org/apache/camel/component/controlbus/ControlBusRestartRouteTest.java +++ b/camel-core/src/test/java/org/apache/camel/component/controlbus/ControlBusRestartRouteTest.java @@ -31,7 +31,7 @@ public class ControlBusRestartRouteTest extends ContextTestSupport { assertEquals("Started", context.getRouteStatus("foo").name()); - template.sendBody("controlbus:route?routeId=foo&action=restart", null); + template.sendBody("controlbus:route?routeId=foo&action=restart&restartDelay=0", null); assertEquals("Started", context.getRouteStatus("foo").name()); -- To stop receiving notification emails like this one, please contact davscl...@apache.org.