org.springframework.cloud.task.repository.TaskNameResolver Java Examples

The following examples show how to use org.springframework.cloud.task.repository.TaskNameResolver. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: TaskLifecycleListener.java    From spring-cloud-task with Apache License 2.0 6 votes vote down vote up
/**
 * @param taskRepository {@link TaskRepository} to record executions.
 * @param taskNameResolver {@link TaskNameResolver} used to determine task name for
 * task execution.
 * @param applicationArguments {@link ApplicationArguments} to be used for task
 * execution.
 * @param taskExplorer {@link TaskExplorer} to be used for task execution.
 * @param taskProperties {@link TaskProperties} to be used for the task execution.
 * @param taskListenerExecutorObjectFactory {@link TaskListenerExecutorObjectFactory}
 * to initialize TaskListenerExecutor for a task
 */
public TaskLifecycleListener(TaskRepository taskRepository,
		TaskNameResolver taskNameResolver, ApplicationArguments applicationArguments,
		TaskExplorer taskExplorer, TaskProperties taskProperties,
		TaskListenerExecutorObjectFactory taskListenerExecutorObjectFactory) {
	Assert.notNull(taskRepository, "A taskRepository is required");
	Assert.notNull(taskNameResolver, "A taskNameResolver is required");
	Assert.notNull(taskExplorer, "A taskExplorer is required");
	Assert.notNull(taskProperties, "TaskProperties is required");
	Assert.notNull(taskListenerExecutorObjectFactory,
			"A TaskListenerExecutorObjectFactory is required");

	this.taskRepository = taskRepository;
	this.taskNameResolver = taskNameResolver;
	this.applicationArguments = applicationArguments;
	this.taskExplorer = taskExplorer;
	this.taskProperties = taskProperties;
	this.taskListenerExecutorObjectFactory = taskListenerExecutorObjectFactory;
	this.taskMetrics = new TaskMetrics();
}
 
Example #2
Source File: TaskLifecycleConfiguration.java    From spring-cloud-task with Apache License 2.0 5 votes vote down vote up
@Autowired
public TaskLifecycleConfiguration(TaskProperties taskProperties,
		ConfigurableApplicationContext context, TaskRepository taskRepository,
		TaskExplorer taskExplorer, TaskNameResolver taskNameResolver,
		ObjectProvider<ApplicationArguments> applicationArguments) {

	this.taskProperties = taskProperties;
	this.context = context;
	this.taskRepository = taskRepository;
	this.taskExplorer = taskExplorer;
	this.taskNameResolver = taskNameResolver;
	this.applicationArguments = applicationArguments.getIfAvailable();
}
 
Example #3
Source File: SingleInstanceTaskListener.java    From spring-cloud-task with Apache License 2.0 5 votes vote down vote up
public SingleInstanceTaskListener(LockRegistry lockRegistry,
		TaskNameResolver taskNameResolver, TaskProperties taskProperties,
		ApplicationEventPublisher applicationEventPublisher) {
	this.lockRegistry = lockRegistry;
	this.taskNameResolver = taskNameResolver;
	this.taskProperties = taskProperties;
	this.lockRegistryLeaderInitiator = new LockRegistryLeaderInitiator(
			this.lockRegistry);
	this.applicationEventPublisher = applicationEventPublisher;
}
 
Example #4
Source File: SingleInstanceTaskListener.java    From spring-cloud-task with Apache License 2.0 5 votes vote down vote up
public SingleInstanceTaskListener(DataSource dataSource,
		TaskNameResolver taskNameResolver, TaskProperties taskProperties,
		ApplicationEventPublisher applicationEventPublisher) {
	this.taskNameResolver = taskNameResolver;
	this.applicationEventPublisher = applicationEventPublisher;
	this.dataSource = dataSource;
	this.taskProperties = taskProperties;
}
 
Example #5
Source File: SingleTaskConfiguration.java    From spring-cloud-task with Apache License 2.0 5 votes vote down vote up
@Bean
public SingleInstanceTaskListener taskListener(TaskNameResolver resolver) {
	if (this.taskConfigurer.getTaskDataSource() == null) {
		return new SingleInstanceTaskListener(new PassThruLockRegistry(), resolver,
				this.taskProperties, this.applicationEventPublisher);
	}

	return new SingleInstanceTaskListener(this.taskConfigurer.getTaskDataSource(),
			resolver, this.taskProperties, this.applicationEventPublisher);
}
 
Example #6
Source File: SimpleTaskAutoConfiguration.java    From spring-cloud-task with Apache License 2.0 4 votes vote down vote up
@Bean
public TaskNameResolver taskNameResolver() {
	return new SimpleTaskNameResolver();
}
 
Example #7
Source File: TestDefaultConfiguration.java    From spring-cloud-task with Apache License 2.0 4 votes vote down vote up
@Bean
public TaskNameResolver taskNameResolver() {
	return new SimpleTaskNameResolver();
}