Hi Supervising route controller is ONLY for starting the route, which will be errors during startup of the route which mostly often are in the consumer, but can be in a producer if it does some start/init logic that fails. And as you use a timer component then that startup perfectly.
When you have errors later during routing then its Camels regular error handler that deals with that, where you can use errorHandler / onException etc. On Thu, Jan 14, 2021 at 9:14 PM Imran Raza Khan <[email protected]> wrote: > > I have quarkus application with camel route like below, its not working as > expected or i may have different understanding > > from("timer://ipc?repeatCount=1&delay=60000") > .routeId("timer-ipc") > .to("kubernetes-secrets:///?kubernetesClient=#kubernetesClient&operation=getSecret") > .setHeader("AMQ_PASSWORD").groovy("new String( > request.getBody().getData().get('amq-password').decodeBase64() )"); > .setHeader(PahoConstants.MQTT_TOPIC, simple("di_status")) > .bean(new UpsStatusRoute(), "createUpsStatusRoute"); > .to("log:log?showAll=true&multiline=true"); > > **application.properties:** > > camel.main.routeControllerSuperviseEnabled = true > camel.main.routeControllerBackoffDelay = 5000 > camel.main.routeControllerInitialDelay = 1000 > > I am expecting that if kubernetes cluster is not available and throw error > SupervisingRouterController should retry but as i have repeatCount =1, it > just exit after error > > > 2021-01-14 19:58:13,797 INFO [io.quarkus] (main) ipc-manager 3.0.0 on > JVM (powered by Quarkus 1.10.3.Final) started in 1.307s. > 2021-01-14 19:58:13,797 INFO [io.quarkus] (main) Profile prod > activated. > 2021-01-14 19:58:13,797 INFO [io.quarkus] (main) Installed features: > [camel-activemq, camel-bean, camel-core, camel-direct, camel-exec, > camel-groovy, camel-grpc, camel-jms, camel-jsonpath, camel-kubernetes, > camel-log, camel-main, camel-nats, camel-paho, camel-protobuf, > camel-support-common, camel-support-commons-logging, camel-support-spring, > camel-timer, cdi, kubernetes-client, mutiny, smallrye-context-propagation, > vertx] > 2021-01-14 19:58:13,865 INFO [org.apa.cam.mai.BaseMainSupport] (main) > Auto-configuration summary: > 2021-01-14 19:58:13,865 INFO [org.apa.cam.mai.BaseMainSupport] (main) > camel.main.routeControllerSuperviseEnabled=true > 2021-01-14 19:58:13,866 INFO [org.apa.cam.mai.BaseMainSupport] (main) > camel.main.routeControllerInitialDelay=1000 > 2021-01-14 19:58:13,866 INFO [org.apa.cam.mai.BaseMainSupport] (main) > camel.main.routeControllerBackoffDelay=5000 > 2021-01-14 19:58:13,866 INFO [org.apa.cam.mai.BaseMainSupport] (main) > > camel.component.log.exchangeFormatter=#class:org.apache.camel.support.processor.DefaultExchangeFormatter > 2021-01-14 19:58:14,031 INFO > [org.apa.cam.imp.eng.AbstractCamelContext] (main) Apache Camel 3.7.0 > (camel-1) is starting > 2021-01-14 19:58:14,038 DEBUG > [org.apa.cam.imp.eng.AbstractCamelContext] (main) Skip starting routes as > CamelContext has been configured with autoStartup=false > 2021-01-14 19:58:14,038 DEBUG > [org.apa.cam.imp.eng.InternalRouteStartupManager] (main) Warming up route > id: timer-ipc having autoStartup=false > 2021-01-14 19:58:14,057 INFO > [org.apa.cam.imp.eng.AbstractCamelContext] (main) Total 3 routes, of which > 0 are started, and 3 are managed by RouteController: > org.apache.camel.impl.engine.DefaultSupervisingRouteController > 2021-01-14 19:58:14,057 INFO > [org.apa.cam.imp.eng.AbstractCamelContext] (main) Apache Camel 3.7.0 > (camel-1) started in 26ms > 2021-01-14 19:58:14,060 DEBUG > [org.apa.cam.imp.eng.DefaultSupervisingRouteController] (main) Supervised > routes will be started in 1000 millis > 2021-01-14 19:58:14,063 DEBUG > [org.apa.cam.mai.SimpleMainShutdownStrategy] (camel-main) Await shutdown to > complete > 2021-01-14 19:58:15,062 DEBUG > [org.apa.cam.imp.eng.DefaultSupervisingRouteController] (Camel (camel-1) > thread #0 - SupervisingRouteController) Starting 3 supervised routes > 2021-01-14 19:58:15,064 DEBUG > [org.apa.cam.imp.eng.InternalRouteStartupManager] (Camel (camel-1) thread > #0 - SupervisingRouteController) Warming up route id: timer-ipc having > autoStartup=true > 2021-01-14 19:58:15,064 DEBUG > [org.apa.cam.imp.eng.InternalRouteStartupManager] (Camel (camel-1) thread > #0 - SupervisingRouteController) Route: timer-ipc >>> > Route[timer://ipc?delay=60000&repeatCount=1 -> null] > 2021-01-14 19:58:15,064 DEBUG > [org.apa.cam.imp.eng.InternalRouteStartupManager] (Camel (camel-1) thread > #0 - SupervisingRouteController) Starting consumer (order: 1003) on route: > timer-ipc > 2021-01-14 19:58:15,065 DEBUG [org.apa.cam.sup.DefaultConsumer] (Camel > (camel-1) thread #0 - SupervisingRouteController) Starting consumer: > Consumer[timer://ipc?delay=60000&repeatCount=1] > 2021-01-14 19:58:15,066 INFO > [org.apa.cam.imp.eng.InternalRouteStartupManager] (Camel (camel-1) thread > #0 - SupervisingRouteController) Route: timer-ipc started and consuming > from: timer://ipc > 2021-01-14 19:58:15,067 DEBUG > [org.apa.cam.imp.eng.InternalRouteStartupManager] (Camel (camel-1) thread > #0 - SupervisingRouteController) Warming up route id: > GetGpnAndPkgCtrlIdFromYQConfig having autoStartup=true > 2021-01-14 19:58:15,068 DEBUG > [org.apa.cam.imp.eng.InternalRouteStartupManager] (Camel (camel-1) thread > #0 - SupervisingRouteController) Route: GetGpnAndPkgCtrlIdFromYQConfig >>> > Route[direct://GetGpnAndPkgCtrlIdFromYQConfig -> null] > 2021-01-14 19:58:15,068 DEBUG > [org.apa.cam.imp.eng.InternalRouteStartupManager] (Camel (camel-1) thread > #0 - SupervisingRouteController) Starting consumer (order: 1004) on route: > GetGpnAndPkgCtrlIdFromYQConfig > 2021-01-14 19:58:15,068 DEBUG [org.apa.cam.sup.DefaultConsumer] (Camel > (camel-1) thread #0 - SupervisingRouteController) Init consumer: > Consumer[direct://GetGpnAndPkgCtrlIdFromYQConfig] > 2021-01-14 19:58:15,068 DEBUG [org.apa.cam.sup.DefaultConsumer] (Camel > (camel-1) thread #0 - SupervisingRouteController) Starting consumer: > Consumer[direct://GetGpnAndPkgCtrlIdFromYQConfig] > 2021-01-14 19:58:15,069 INFO > [org.apa.cam.imp.eng.InternalRouteStartupManager] (Camel (camel-1) thread > #0 - SupervisingRouteController) Route: GetGpnAndPkgCtrlIdFromYQConfig > started and consuming from: direct://GetGpnAndPkgCtrlIdFromYQConfig > 2021-01-14 19:58:15,069 DEBUG > [org.apa.cam.imp.eng.InternalRouteStartupManager] (Camel (camel-1) thread > #0 - SupervisingRouteController) Warming up route id: > StartMonitoringUpsBatteryStatus having autoStartup=true > 2021-01-14 19:58:15,069 DEBUG > [org.apa.cam.imp.eng.InternalRouteStartupManager] (Camel (camel-1) thread > #0 - SupervisingRouteController) Route: StartMonitoringUpsBatteryStatus >>> > Route[direct://StartMonitoringUpsBatteryStatus -> null] > 2021-01-14 19:58:15,070 DEBUG > [org.apa.cam.imp.eng.InternalRouteStartupManager] (Camel (camel-1) thread > #0 - SupervisingRouteController) Starting consumer (order: 1005) on route: > StartMonitoringUpsBatteryStatus > 2021-01-14 19:58:15,070 DEBUG [org.apa.cam.sup.DefaultConsumer] (Camel > (camel-1) thread #0 - SupervisingRouteController) Init consumer: > Consumer[direct://StartMonitoringUpsBatteryStatus] > 2021-01-14 19:58:15,070 DEBUG [org.apa.cam.sup.DefaultConsumer] (Camel > (camel-1) thread #0 - SupervisingRouteController) Starting consumer: > Consumer[direct://StartMonitoringUpsBatteryStatus] > 2021-01-14 19:58:15,070 INFO > [org.apa.cam.imp.eng.InternalRouteStartupManager] (Camel (camel-1) thread > #0 - SupervisingRouteController) Route: StartMonitoringUpsBatteryStatus > started and consuming from: direct://StartMonitoringUpsBatteryStatus > 2021-01-14 19:58:15,071 INFO > [org.apa.cam.imp.eng.DefaultSupervisingRouteController] (Camel (camel-1) > thread #0 - SupervisingRouteController) Total managed routes: 3 of which 3 > successfully started (restarting: 0, exhausted: 0) > 2021-01-14 19:59:15,148 ERROR [org.apa.cam.pro.err.DefaultErrorHandler] > (Camel (camel-1) thread #1 - timer://ipc) Failed delivery for (MessageId: > 589FABDEA9246FC-0000000000000000 on ExchangeId: > 589FABDEA9246FC-0000000000000000). Exhausted after delivery attempt: 1 > caught: io.fabric8.kubernetes.client.KubernetesClientException: Operation: > [get] for kind: [Secret] with name: [broker] in namespace: [production] > failed. > Message History (complete message history is disabled) > > --------------------------------------------------------------------------------------------------------------------------------------- > RouteId ProcessorId Processor > Elapsed (ms) > [timer-ipc ] [timer-ipc ] > [from[timer://ipc?delay=60000&repeatCount=1] > ] [ 79] > ... > [GetGpnAndPkgCtrlId] [to4 ] > [kubernetes-secrets:///?kubernetesClient=#kubernetesClient&operation=getSecret > ] [ 0] > > Stacktrace > > --------------------------------------------------------------------------------------------------------------------------------------- > : io.fabric8.kubernetes.client.KubernetesClientException: Operation: > [get] for kind: [Secret] with name: [broker] in namespace: [production] > failed. > at > io.fabric8.kubernetes.client.KubernetesClientException.launderThrowable(KubernetesClientException.java:64) > at > io.fabric8.kubernetes.client.KubernetesClientException.launderThrowable(KubernetesClientException.java:72) > at > io.fabric8.kubernetes.client.dsl.base.BaseOperation.getMandatory(BaseOperation.java:225) > at > io.fabric8.kubernetes.client.dsl.base.BaseOperation.get(BaseOperation.java:186) > at > io.fabric8.kubernetes.client.dsl.base.BaseOperation.get(BaseOperation.java:84) > at > org.apache.camel.component.kubernetes.secrets.KubernetesSecretsProducer.doGetSecret(KubernetesSecretsProducer.java:130) > at > org.apache.camel.component.kubernetes.secrets.KubernetesSecretsProducer.process(KubernetesSecretsProducer.java:72) > at > org.apache.camel.support.AsyncProcessorConverterHelper$ProcessorToAsyncProcessorBridge.process(AsyncProcessorConverterHelper.java:66) > at > org.apache.camel.processor.SendProcessor.lambda$process$2(SendProcessor.java:188) > at > org.apache.camel.support.cache.DefaultProducerCache.doInAsyncProducer(DefaultProducerCache.java:317) > at > org.apache.camel.processor.SendProcessor.process(SendProcessor.java:187) > at > org.apache.camel.processor.errorhandler.RedeliveryErrorHandler$SimpleTask.run(RedeliveryErrorHandler.java:395) > at > org.apache.camel.impl.engine.DefaultReactiveExecutor$Worker.schedule(DefaultReactiveExecutor.java:148) > at > org.apache.camel.impl.engine.DefaultReactiveExecutor.scheduleMain(DefaultReactiveExecutor.java:60) > at > org.apache.camel.processor.Pipeline.process(Pipeline.java:147) > at > org.apache.camel.impl.engine.CamelInternalProcessor.process(CamelInternalProcessor.java:312) > at > org.apache.camel.component.timer.TimerConsumer.sendTimerExchange(TimerConsumer.java:207) > at > org.apache.camel.component.timer.TimerConsumer$1.run(TimerConsumer.java:76) > at java.util.TimerThread.mainLoop(Timer.java:555) > at java.util.TimerThread.run(Timer.java:505) > Caused by: javax.net.ssl.SSLHandshakeException: Remote host closed > connection during handshake > 2021-01-14 19:59:15,151 DEBUG [org.apa.cam.pro.Pipeline] (Camel > (camel-1) thread #1 - timer://ipc) Message exchange has failed: so breaking > out of pipeline for exchange: Exchange[589FABDEA9246FC-0000000000000000] > Exception: io.fabric8.kubernetes.client.KubernetesClientException: > Operation: [get] for kind: [Secret] with name: [broker] in namespace: > [production] failed. > 2021-01-14 19:59:15,151 DEBUG [org.apa.cam.pro.Pipeline] (Camel > (camel-1) thread #1 - timer://ipc) Message exchange has failed: so breaking > out of pipeline for exchange: Exchange[589FABDEA9246FC-0000000000000000] > Exception: io.fabric8.kubernetes.client.KubernetesClientException: > Operation: [get] for kind: [Secret] with name: [broker] in namespace: > [production] failed. > 2021-01-14 19:59:15,152 WARN [org.apa.cam.com.tim.TimerConsumer] > (Camel (camel-1) thread #1 - timer://ipc) Error processing exchange. > Exchange[589FABDEA9246FC-0000000000000000]. Caused by: > [io.fabric8.kubernetes.client.KubernetesClientException - Operation: [get] > for kind: [Secret] with name: [broker] in namespace: [production] > failed.]: io.fabric8.kubernetes.client.KubernetesClientException: > Operation: [get] for kind: [Secret] with name: [broker] in namespace: > [production] failed. > 2021-01-14 19:59:16,066 DEBUG [org.apa.cam.com.tim.TimerConsumer] > (Camel (camel-1) thread #1 - timer://ipc) Cancelling ipc timer as repeat > count limit reached after 1 counts. -- Claus Ibsen ----------------- http://davsclaus.com @davsclaus Camel in Action 2: https://www.manning.com/ibsen2
