Apache camel Quartz start immediatly after application startup and then every hour

31 Views Asked by At

How can i configure my camel quartz to be triggered just after application startup and then every hour. is there a property or an option that i can use in order to achieve my need.

Bellow is my route definition

@Component
public class LoadUserQuartzRoute extends BaseRoute {

    public LoadUserQuartzRoute() {
    }

    @Override
    public void configure() throws Exception {
        
        from(triggerQuartz())
                .routeId("loadUsers")

                .bean(UserService.class, "load")

                .to("destination");
    }

    public String triggerQuartz() {
        return quartz("groupScheduler/loadUsers")
                .triggerStartDelay(0)
                .cron("0 0 * ? * * *")
                .getUri();
    }
}

Any help would be appreciate !!

1

There are 1 best solutions below

3
bgossit On

The Quartz schedule runs at specific times of day.

Instead you could use the Timer component with settings like delay=0 fixedRate=true period=3600000

See https://camel.apache.org/components/4.4.x/timer-component.html