Class DefaultSchedulerService
java.lang.Object
org.springframework.cloud.dataflow.server.service.impl.DefaultSchedulerService
- All Implemented Interfaces:
SchedulerService
Default implementation of the
SchedulerService interface. Provide service methods
for Scheduling tasks.- Author:
- Glenn Renfro, Chris Schaefer, Ilayaperumal Gopinathan
-
Constructor Summary
ConstructorsConstructorDescriptionDefaultSchedulerService(CommonApplicationProperties commonApplicationProperties, List<TaskPlatform> taskPlatforms, TaskDefinitionRepository taskDefinitionRepository, AppRegistryService registry, ResourceLoader resourceLoader, TaskConfigurationProperties taskConfigurationProperties, org.springframework.boot.autoconfigure.jdbc.DataSourceProperties dataSourceProperties, String dataflowServerUri, ApplicationConfigurationMetadataResolver metaDataResolver, SchedulerServiceProperties schedulerServiceProperties, org.springframework.cloud.dataflow.audit.service.AuditRecordService auditRecordService, TaskExecutionInfoService taskExecutionInfoService, PropertyResolver propertyResolver, ComposedTaskRunnerConfigurationProperties composedTaskRunnerConfigurationProperties) Constructor for DefaultSchedulerService -
Method Summary
Modifier and TypeMethodDescriptionorg.springframework.cloud.deployer.spi.scheduler.ScheduleInfogetSchedule(String scheduleName) Retrieves theScheduleInfofor the specified ScheduleName from the default platform.org.springframework.cloud.deployer.spi.scheduler.ScheduleInfogetSchedule(String scheduleName, String platformName) Retrieves theScheduleInfofor the specified ScheduleName.protected ResourcegetTaskResource(String taskDefinitionName, String version) List<org.springframework.cloud.deployer.spi.scheduler.ScheduleInfo>list()List all of the schedules registered with the default platform up to the established maximum as specifiedSchedulerServiceProperties.maxSchedulesReturned.List<org.springframework.cloud.deployer.spi.scheduler.ScheduleInfo>List all of the Schedules associated with the provided TaskDefinition for the default platform up to the established maximum as specifiedSchedulerServiceProperties.maxSchedulesReturned.List<org.springframework.cloud.deployer.spi.scheduler.ScheduleInfo>List all of the Schedules associated with the provided TaskDefinition up to the established maximum as specifiedSchedulerServiceProperties.maxSchedulesReturned.org.springframework.data.domain.Page<org.springframework.cloud.deployer.spi.scheduler.ScheduleInfo>list(org.springframework.data.domain.Pageable pageable) List all of the schedules registered with the default platform.org.springframework.data.domain.Page<org.springframework.cloud.deployer.spi.scheduler.ScheduleInfo>List all of the schedules registered with the system.List<org.springframework.cloud.deployer.spi.scheduler.ScheduleInfo>list(org.springframework.data.domain.Pageable pageable, String taskDefinitionName, String platformName) List all of the Schedules associated with the provided TaskDefinition.List<org.springframework.cloud.deployer.spi.scheduler.ScheduleInfo>listForPlatform(String platformName) List all of the schedules registered with the system up to the established maximum as specifiedSchedulerServiceProperties.maxSchedulesReturned.voidschedule(String scheduleName, String taskDefinitionName, Map<String, String> taskDeploymentProperties, List<String> commandLineArgs) Schedules the task specified with the taskDefinitionName with the default platform specific scheduler.voidschedule(String scheduleName, String taskDefinitionName, Map<String, String> taskDeploymentProperties, List<String> commandLineArgs, String platformName) Schedules the task specified with the taskDefinitionName with the platform specific scheduler.voidunschedule(String scheduleName) Unschedule a schedule that has been created for the default platform.voidunschedule(String scheduleName, String platformName) Unschedule a schedule that has been created.voidunscheduleForTaskDefinition(String taskDefinitionName) Unschedule all schedules that have been created for this task definition name.
-
Constructor Details
-
DefaultSchedulerService
public DefaultSchedulerService(CommonApplicationProperties commonApplicationProperties, List<TaskPlatform> taskPlatforms, TaskDefinitionRepository taskDefinitionRepository, AppRegistryService registry, ResourceLoader resourceLoader, TaskConfigurationProperties taskConfigurationProperties, org.springframework.boot.autoconfigure.jdbc.DataSourceProperties dataSourceProperties, String dataflowServerUri, ApplicationConfigurationMetadataResolver metaDataResolver, SchedulerServiceProperties schedulerServiceProperties, org.springframework.cloud.dataflow.audit.service.AuditRecordService auditRecordService, TaskExecutionInfoService taskExecutionInfoService, PropertyResolver propertyResolver, ComposedTaskRunnerConfigurationProperties composedTaskRunnerConfigurationProperties) Constructor for DefaultSchedulerService- Parameters:
commonApplicationProperties- common properties for applications deployed via Spring Cloud Data Flow.taskPlatforms- theTaskPlatforms for this service.taskDefinitionRepository- theTaskDefinitionRepositoryfor this service.registry- theAppRegistryServicefor this service.resourceLoader- theResourceLoaderfor this service.taskConfigurationProperties- theTaskConfigurationPropertiesfor this service.dataSourceProperties- theDataSourcePropertiesfor this service.dataflowServerUri- the Spring Cloud Data Flow uri for this service.metaDataResolver- theApplicationConfigurationMetadataResolverfor this service.schedulerServiceProperties- theSchedulerServicePropertiesfor this service.auditRecordService- theAuditRecordServicefor this service.taskExecutionInfoService- theTaskExecutionInfoServicefor this servicepropertyResolver- thePropertyResolverfor this servicecomposedTaskRunnerConfigurationProperties- theComposedTaskRunnerConfigurationPropertiesfor this service
-
-
Method Details
-
schedule
public void schedule(String scheduleName, String taskDefinitionName, Map<String, String> taskDeploymentProperties, List<String> commandLineArgs) Description copied from interface:SchedulerServiceSchedules the task specified with the taskDefinitionName with the default platform specific scheduler. To setup the task with the scheduler set the properties required to process the schedule within the taskProperties map. Each scheduler property should be prefixed with "spring.cloud.scheduler.". The schedule expression (cron for example) are specified within the task properties using the "spring.cloud.scheduler.cron.expression" as the key and the associated value would be the cron expression to be used.- Specified by:
schedulein interfaceSchedulerService- Parameters:
scheduleName- A name to be associated with the schedule.taskDefinitionName- the name of theTaskDefinitionto be scheduled.taskDeploymentProperties- properties required for scheduling or launching a task.commandLineArgs- the command line args to be used when launching the task.
-
schedule
public void schedule(String scheduleName, String taskDefinitionName, Map<String, String> taskDeploymentProperties, List<String> commandLineArgs, String platformName) Description copied from interface:SchedulerServiceSchedules the task specified with the taskDefinitionName with the platform specific scheduler. To setup the task with the scheduler set the properties required to process the schedule within the taskProperties map. Each scheduler property should be prefixed with "spring.cloud.scheduler.". The schedule expression (cron for example) are specified within the task properties using the "spring.cloud.scheduler.cron.expression" as the key and the associated value would be the cron expression to be used.- Specified by:
schedulein interfaceSchedulerService- Parameters:
scheduleName- A name to be associated with the schedule.taskDefinitionName- the name of theTaskDefinitionto be scheduled.taskDeploymentProperties- properties required for scheduling or launching a task.commandLineArgs- the command line args to be used when launching the task.platformName- the name of the platform where the schedule should be created.
-
unschedule
Description copied from interface:SchedulerServiceUnschedule a schedule that has been created.- Specified by:
unschedulein interfaceSchedulerService- Parameters:
scheduleName- the name of the schedule to be removed.platformName- the name of the platform from where the schedule will be destroyed.
-
unschedule
Description copied from interface:SchedulerServiceUnschedule a schedule that has been created for the default platform.- Specified by:
unschedulein interfaceSchedulerService- Parameters:
scheduleName- the name of the schedule to be removed.
-
unscheduleForTaskDefinition
Description copied from interface:SchedulerServiceUnschedule all schedules that have been created for this task definition name.- Specified by:
unscheduleForTaskDefinitionin interfaceSchedulerService- Parameters:
taskDefinitionName- the name of the task definition.
-
list
public List<org.springframework.cloud.deployer.spi.scheduler.ScheduleInfo> list(org.springframework.data.domain.Pageable pageable, String taskDefinitionName, String platformName) Description copied from interface:SchedulerServiceList all of the Schedules associated with the provided TaskDefinition.- Specified by:
listin interfaceSchedulerService- Parameters:
pageable- Establish the pagination setup for the result set.taskDefinitionName- to retrieve Schedules for a specified taskDefinitionName.platformName- name of platform from which the schedules will be retrieved.- Returns:
- A List of Schedules configured for the provided taskDefinitionName.
-
list
public org.springframework.data.domain.Page<org.springframework.cloud.deployer.spi.scheduler.ScheduleInfo> list(org.springframework.data.domain.Pageable pageable, String platformName) Description copied from interface:SchedulerServiceList all of the schedules registered with the system.- Specified by:
listin interfaceSchedulerService- Parameters:
pageable- Establish the pagination setup for the result set.platformName- the name of the platform where schedules will be obtained.- Returns:
- Paged items of schedules.
-
list
public org.springframework.data.domain.Page<org.springframework.cloud.deployer.spi.scheduler.ScheduleInfo> list(org.springframework.data.domain.Pageable pageable) Description copied from interface:SchedulerServiceList all of the schedules registered with the default platform.- Specified by:
listin interfaceSchedulerService- Parameters:
pageable- Establish the pagination setup for the result set.- Returns:
- Paged items of schedules.
-
list
public List<org.springframework.cloud.deployer.spi.scheduler.ScheduleInfo> list(String taskDefinitionName, String platformName) Description copied from interface:SchedulerServiceList all of the Schedules associated with the provided TaskDefinition up to the established maximum as specifiedSchedulerServiceProperties.maxSchedulesReturned.- Specified by:
listin interfaceSchedulerService- Parameters:
taskDefinitionName- to retrieve Schedules for a specified taskDefinitionName.platformName- the name of the platform where schedules will be retrieved.- Returns:
- A List of Schedules configured for the provided taskDefinitionName.
-
list
public List<org.springframework.cloud.deployer.spi.scheduler.ScheduleInfo> list(String taskDefinitionName) Description copied from interface:SchedulerServiceList all of the Schedules associated with the provided TaskDefinition for the default platform up to the established maximum as specifiedSchedulerServiceProperties.maxSchedulesReturned.- Specified by:
listin interfaceSchedulerService- Parameters:
taskDefinitionName- to retrieve Schedules for a specified taskDefinitionName.- Returns:
- A List of Schedules configured for the provided taskDefinitionName.
-
listForPlatform
public List<org.springframework.cloud.deployer.spi.scheduler.ScheduleInfo> listForPlatform(String platformName) Description copied from interface:SchedulerServiceList all of the schedules registered with the system up to the established maximum as specifiedSchedulerServiceProperties.maxSchedulesReturned.- Specified by:
listForPlatformin interfaceSchedulerService- Parameters:
platformName- the name for the platform where schedules will be retrieved.- Returns:
- A List of Schedules for the given system.
-
list
Description copied from interface:SchedulerServiceList all of the schedules registered with the default platform up to the established maximum as specifiedSchedulerServiceProperties.maxSchedulesReturned.- Specified by:
listin interfaceSchedulerService- Returns:
- A List of Schedules for the given system.
-
getSchedule
public org.springframework.cloud.deployer.spi.scheduler.ScheduleInfo getSchedule(String scheduleName, String platformName) Description copied from interface:SchedulerServiceRetrieves theScheduleInfofor the specified ScheduleName.- Specified by:
getSchedulein interfaceSchedulerService- Parameters:
scheduleName- the name of schedule to retrieve.platformName- the name of the platform where this schedule will be obtained.- Returns:
ScheduleInfofor the scheduleName passed in.
-
getSchedule
public org.springframework.cloud.deployer.spi.scheduler.ScheduleInfo getSchedule(String scheduleName) Description copied from interface:SchedulerServiceRetrieves theScheduleInfofor the specified ScheduleName from the default platform.- Specified by:
getSchedulein interfaceSchedulerService- Parameters:
scheduleName- the name of schedule to retrieve.- Returns:
ScheduleInfofor the scheduleName passed in.
-
getTaskResource
-