Search in sources :

Example 1 with SyncHandler

use of io.gravitee.gateway.services.sync.handler.SyncHandler in project gravitee-gateway by gravitee-io.

the class ScheduledSyncService method doStart.

@Override
protected void doStart() throws Exception {
    if (!localRegistryEnabled) {
        if (enabled) {
            super.doStart();
            logger.info("Sync service has been initialized with cron [{}]", cronTrigger);
            // Sync must start only when doStart() is invoked, that's the reason why we are not
            // using @Scheduled annotation on doSync() method.
            scheduler.schedule(this, new CronTrigger(cronTrigger));
            logger.info("Associate a new HTTP handler on {}", PATH);
            // Create and associate handler
            SyncHandler syncHandler = new SyncHandler();
            applicationContext.getAutowireCapableBeanFactory().autowireBean(syncHandler);
            router.get(PATH).produces(MediaType.APPLICATION_JSON).handler(syncHandler);
        } else {
            logger.warn("Sync service has been disabled");
        }
    } else {
        logger.warn("Sync service is disabled because local registry mode is enabled");
    }
}
Also used : CronTrigger(org.springframework.scheduling.support.CronTrigger) SyncHandler(io.gravitee.gateway.services.sync.handler.SyncHandler)

Aggregations

SyncHandler (io.gravitee.gateway.services.sync.handler.SyncHandler)1 CronTrigger (org.springframework.scheduling.support.CronTrigger)1