You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@camel.apache.org by "Prasanth Ganesh Rao (Jira)" <ji...@apache.org> on 2022/07/28 08:08:00 UTC

[jira] [Comment Edited] (CAMEL-18318) camel-quartz - Context fails to start when one of the cron configuration has expired

    [ https://issues.apache.org/jira/browse/CAMEL-18318?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17572266#comment-17572266 ] 

Prasanth Ganesh Rao edited comment on CAMEL-18318 at 7/28/22 8:07 AM:
----------------------------------------------------------------------

[~davsclaus] Thanks for the suggestion. How can I skip the route upon the exception? Would you have an example for the same?


was (Author: pgrao):
[~davsclaus] Thanks for the suggestion. How can I skip the route upon the exception? Would you have an example for the same? I tried the below snippet however it still fails with the same exception with executing the iflow
{code:java}
package org.apache.camel.quartz.test;import org.apache.camel.builder.RouteBuilder;
import org.apache.camel.component.mock.MockEndpoint;
import org.apache.camel.spi.SupervisingRouteController;
import org.apache.camel.test.junit4.CamelTestSupport;
import org.junit.Test;public class ExpiredScheduleTest extends CamelTestSupport {    @Override
    public boolean isUseRouteBuilder() {
        return false;
    }    @Test
    public void testRouteController() throws Exception {        // Has an expired schedule
        RouteBuilder expiredScheduleRoute = new RouteBuilder() {            @Override
            public void configure() throws Exception {
                // Expired schedule. Uncomment to reproduce the error
                String quartz = "quartz://myGroup/expired?cron=0+0+0+1+JAN+?+2020";
                from(quartz).to("mock:result");
            }
        };
        context.addRoutes(expiredScheduleRoute);
        // Has a valid recurring schedule
        RouteBuilder recurringScheduleRoute = new RouteBuilder() {            @Override
            public void configure() throws Exception {
                from("quartz://myGroup/myTimerName?cron=0/2+*+*+*+*+?").to("mock:result");
            }
        };
        context.addRoutes(recurringScheduleRoute);        SupervisingRouteController src = context.getRouteController().supervising();
        src.setBackOffDelay(25);
        src.setInitialDelay(100);
        src.setThreadPoolSize(2);        MockEndpoint mock = getMockEndpoint("mock:result");
        context.start();        Thread.sleep(5 * 1000);
        mock.expectedMinimumMessageCount(1);
        assertMockEndpointsSatisfied();
        context.stop();    }
    
}
 {code}

> camel-quartz - Context fails to start when one of the cron configuration has expired
> ------------------------------------------------------------------------------------
>
>                 Key: CAMEL-18318
>                 URL: https://issues.apache.org/jira/browse/CAMEL-18318
>             Project: Camel
>          Issue Type: Improvement
>          Components: camel-quartz
>            Reporter: Prasanth Ganesh Rao
>            Priority: Minor
>             Fix For: 3.19.0
>
>         Attachments: quartz-error.zip
>
>
> We have integration scenarios with muliple quartz _from_ endpoints in a single camel context deployed as osgi bundles. We observe that if one of the quartz configuration has no more schedules and if the bundle were to get restarted, the entire context fails to start thereby preventing future execution of other routes. Error seen in the stacktrace
> _Caused by: org.apache.camel.RuntimeCamelException: org.quartz.SchedulerException: Based on configured schedule, the given trigger 'myGroup.expired' will never fire._
>     _at org.apache.camel.RuntimeCamelException.wrapRuntimeException(RuntimeCamelException.java:66)_
> The issue is becoming a blocker for our scenarios with multiple custom future schedules. Updating the quartz configuration each time we encounter the error is becoming difficult. Hence requesting your quick insights and a resoultion.
> I am enclosing a junit to help you recreate the issue. [^quartz-error.zip] The scenario has two routes _expiredScheduleRoute_ and _recurringScheduleRoute._ The expectation is that the context starts and _recurringScheduleRoute_ continues to run every 2 seconds. I believe we may need a parameter to the quartz endpoint to skip the validation for _expiredScheduleRoute_
>  
>  



--
This message was sent by Atlassian Jira
(v8.20.10#820010)