Spring Persistent Tasks
A lightweight and simple task management framework for Spring Boot designed to queue and execute asynchronous tasks with support for database persistence and a user-friendly interface. Perfect for implementing scheduling patterns, outbound patterns, and background job processing in distributed systems.
Built for Spring Boot 3.x with JPA - seamlessly integrates with your existing Spring application.

Key Features ✨
- JPA-Powered Persistence - Automatically persists tasks to your database
- Spring Boot Auto-Configuration - Simple setup with @EnableSpringPersistentTasks
- Clustering Support - Built-in lock management for distributed environments
- Type-Safe Tasks - Generic task definitions with state objects
- Retry Mechanisms - Automatic retry policies for failed executions
- Transactional Integration - Works with Spring's transaction management
- Queue Management - Intelligent task queuing and prioritization
- Different DB Supports - MySQL, azure-sql-edge, PostgreSQL, and H2
Setup with Maven
xml
<dependency>
<groupId>org.sterl.spring</groupId>
<artifactId>spring-persistent-tasks-core</artifactId>
<version>2.x.x</version>
</dependency>Setup Spring
java
@SpringBootApplication
@EnableSpringPersistentTasks
public class ExampleApplication {Create a Task
java
@Bean
PersistentTask<Vehicle> task1(VehicleHttpConnector vehicleHttpConnector) {
return v -> vehicleHttpConnector.send(v);
}Trigger a task
java
@Autowired
PersistentTaskService persistentTaskService;
public void triggerTask1(Vehicle vehicle) {
persistentTaskService.runOrQueue(
TriggerBuilder.newTrigger("task1").state(vehicle).build());
}