https://github.com/sterlp/spring-persistent-tasks
Persistent and user-friendly task management framework for Spring Boot with JPA support, enabling asynchronous task queuing, execution, and scheduling.
https://github.com/sterlp/spring-persistent-tasks
dashboard framework java job jobs jpa outbound-pattern persistent quartz quartz-scheduler scheduled scheduled-jobs scheduled-task scheduled-tasks spring spring-boot task task-scheduling trigger
Last synced: about 2 months ago
JSON representation
Persistent and user-friendly task management framework for Spring Boot with JPA support, enabling asynchronous task queuing, execution, and scheduling.
- Host: GitHub
- URL: https://github.com/sterlp/spring-persistent-tasks
- Owner: sterlp
- License: mit
- Created: 2024-05-28T18:47:40.000Z (almost 2 years ago)
- Default Branch: main
- Last Pushed: 2026-01-11T16:15:29.000Z (3 months ago)
- Last Synced: 2026-01-11T18:03:37.981Z (3 months ago)
- Topics: dashboard, framework, java, job, jobs, jpa, outbound-pattern, persistent, quartz, quartz-scheduler, scheduled, scheduled-jobs, scheduled-task, scheduled-tasks, spring, spring-boot, task, task-scheduling, trigger
- Language: Java
- Homepage: https://spring-persistent-task.sterl.org/
- Size: 15.1 MB
- Stars: 3
- Watchers: 2
- Forks: 1
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
README
[](https://github.com/sterlp/spring-persistent-tasks/actions/workflows/build.yml)
[](https://spring.io/projects/spring-boot)
[](LICENSE)
# Spring Persistent Tasks
A simple task management framework designed to queue and execute asynchronous tasks with support for database persistence and a user-friendly interface. It can be used to implement scheduling patterns or outbound patterns.
Focus is the usage with spring boot and JPA.
Secondary goal is to support [Poor mans Workflow](https://github.com/sterlp/pmw)
# Key Features ✨
1. **JPA-Powered Persistence** - Automatically persists tasks to your database
1. **Spring Boot Auto-Configuration** - Simple setup with @EnableSpringPersistentTasks
1. **Clustering Support for tasks** - Built-in lock management for distributed environments and tasks
1. **Clustering Support for cron tasks** - Support for cron tasks in a cluster - run on just one node
1. **Type-Safe Tasks** - Generic task definitions with state objects
1. **Retry Mechanisms** - Automatic retry policies for failed executions
1. **Transactional Integration** - Works with Spring's transaction management
1. **Queue Management** - Intelligent task queuing and prioritization
1. **Different DB Supports** - MySQL, azure-sql-edge, PostgreSQL, and H2
# Documentation
Use [the doc](https://spring-persistent-task.sterl.org/) for more advanced examples.
The README contains a shorter how to use.
# Known issues
- spring-boot-devtools: cause java.lang.ClassCastException exceptions during the state serialization - this is a java/spring issue
# Known limitations
## DBMS have missing bad row lock implementation
The framework briefly locks a row or trigger to ensure that each trigger is started only on a single node when a cluster is in use. However, some databases still do not support proper row locking and instead lock the entire table. This is not a critical issue but can slow down task selection in very large clusters.
- mySQL
- Azure SQL Edge (maybe also MSSQL)
# DBs for storage
## Tested in the pipeline
- [](https://www.h2database.com)
- [](https://azure.microsoft.com/en-us/products/azure-sql/edge/)
- [](https://www.postgresql.org)
- [](https://mariadb.org)

## Supported in theory
- MSSQL, as azure-sql-edge is tested
## Not supported
- mySQL: sequences are not supported
# JavaDoc
- [JavaDoc](https://sterlp.github.io/spring-persistent-tasks/javadoc-core/org/sterl/spring/persistent_tasks/PersistentTaskService.html)
# Quickstart
- [Maven Central spring-persistent-tasks-core](https://central.sonatype.com/artifact/org.sterl.spring/spring-persistent-tasks-core/versions)
## Setup with Maven
```xml
org.sterl.spring
spring-persistent-tasks-core
2.x.x
```
## Setup Spring
```java
@SpringBootApplication
@EnableSpringPersistentTasks
public class ExampleApplication {
```
## Create a Task
```java
@Bean
PersistentTask 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());
}
```
### JUnit Tests
- [Persistent Task and Testing](https://github.com/sterlp/spring-persistent-tasks/wiki/Triggers-and-Tasks-in-JUnit-Tests)
# Setup DB with Liquibase
Liquibase is supported. Either import all or just the required versions.
## Maven
- [Maven Central spring-persistent-tasks-db](https://central.sonatype.com/artifact/org.sterl.spring/spring-persistent-tasks-db/versions)
## Option 1: Just include the master file
```xml
```
## Option 2: import changesets on by one
```xml
```
# Setup UI
## Maven
- [Maven Central spring-persistent-tasks-ui](https://central.sonatype.com/artifact/org.sterl.spring/spring-persistent-tasks-ui/versions)
```xml
org.sterl.spring
spring-persistent-tasks-ui
x.x.x
```
## Setup Spring
```java
@SpringBootApplication
@EnableSpringPersistentTasks
@EnableSpringPersistentTasksUI
public class ExampleApplication {
```
## Open the UI
- http://localhost:8080/task-ui
## Schedulers

## Triggers

## History

# Alternatives
- quartz
- db-scheduler
- jobrunr