Skip to content

Commit 0fd28c6

Browse files
committed
cleanup the doc
1 parent 6b91e85 commit 0fd28c6

File tree

1 file changed

+10
-67
lines changed

1 file changed

+10
-67
lines changed

README.md

Lines changed: 10 additions & 67 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,11 @@ Focus is the usage with spring boot and JPA.
88

99
Secondary goal is to support [Poor mans Workflow](https://github.com/sterlp/pmw)
1010

11+
# Documentation
12+
13+
Use for more advanced doc the [WIKI](https://github.com/sterlp/spring-persistent-tasks/wiki).
14+
The README contains a shorter how to use.
15+
1116
# DBs for storage
1217

1318
## Tested in the pipeline
@@ -27,11 +32,11 @@ Secondary goal is to support [Poor mans Workflow](https://github.com/sterlp/pmw)
2732

2833
- mySQL: sequences are not supported
2934

30-
# Setup and Run a Task
35+
# JavaDoc
3136

3237
- [JavaDoc](https://sterlp.github.io/spring-persistent-tasks/javadoc-core/org/sterl/spring/persistent_tasks/PersistentTaskService.html)
3338

34-
## Maven
39+
# Maven setup
3540

3641
- [Maven Central spring-persistent-tasks-core](https://central.sonatype.com/artifact/org.sterl.spring/spring-persistent-tasks-core/versions)
3742

@@ -43,7 +48,7 @@ Secondary goal is to support [Poor mans Workflow](https://github.com/sterlp/pmw)
4348
</dependency>
4449
```
4550

46-
## Setup Spring
51+
# Setup Spring
4752

4853
```java
4954
@SpringBootApplication
@@ -131,62 +136,19 @@ public void buildVehicle() {
131136
final var v = new Vehicle();
132137
// set any data to v ...
133138

134-
// EITHER: queue it, will run later
139+
// EITHER: queue it - will always run later
135140
triggerService.queue(BuildVehicleTask.ID.newUniqueTrigger(v));
136141

137-
// OR: will queue it and run it if possible.
142+
// OR: will queue it and run it now if possible.
138143
// if the scheduler service is missing it is same as using the TriggerService
139144
persistentTaskService.runOrQueue(BuildVehicleTask.ID.newUniqueTrigger(v));
140145
}
141146
```
142147

143-
### Build complex Trigger
144-
145-
```java
146-
private final PersistentTaskService persistentTaskService;
147-
148-
public void buildVehicle() {
149-
var trigger = TaskTriggerBuilder
150-
.<Vehicle>newTrigger("task2")
151-
.id("my-id") // will overwrite existing triggers
152-
.state(new Vehicle("funny"))
153-
.runAfter(Duration.ofHours(2))
154-
.build();
155-
156-
persistentTaskService.runOrQueue(trigger);
157-
}
158-
```
159-
160-
### Use a Spring Event
161-
162-
```java
163-
private final ApplicationEventPublisher eventPublisher;
164-
165-
public void buildVehicle() {
166-
// Vehicle has to be Serializable
167-
final var v = new Vehicle();
168-
// send an event with the trigger inside - same as calling the PersistentTaskService
169-
eventPublisher.publishEvent(TriggerTaskCommand.of(BuildVehicleTask.ID.newUniqueTrigger(v)));
170-
}
171-
```
172-
173148
### JUnit Tests
174149

175150
- [Persistent Task and Testing](https://github.com/sterlp/spring-persistent-tasks/wiki/Triggers-and-Tasks-in-JUnit-Tests)
176151

177-
178-
### Spring configuration options
179-
180-
| Property | Type | Description | Default Value |
181-
| ---------------------------------------------- | -------------------- | ------------------------------------------------------------------------ | ------------------ |
182-
| `spring.persistent-tasks.poll-rate` | `java.lang.Integer` | The interval at which the scheduler checks for new tasks, in seconds. | `30` |
183-
| `spring.persistent-tasks.max-threads` | `java.lang.Integer` | The number of threads to use; set to 0 to disable task processing. | `10` |
184-
| `spring.persistent-tasks.task-timeout` | `java.time.Duration` | The maximum time allowed for a task and scheduler to complete a task. | `PT5M` (5 minutes) |
185-
| `spring.persistent-tasks.poll-task-timeout` | `java.lang.Integer` | The interval at which the system checks for abandoned tasks, in seconds. | `300` (5 minutes) |
186-
| `spring.persistent-tasks.scheduler-enabled` | `java.lang.Boolean` | Indicates whether this node should handle triggers. | `true` |
187-
| `spring.persistent-tasks.history.delete-after` | `java.time.Duration` | The max age for a trigger in the hstory. | `PT72H` (30 days) |
188-
| `spring.persistent-tasks.history.delete-rate` | `java.time.Integer` | The interval at which old triggers are deleted, in hours. | `24` (24 hours) |
189-
190152
# Setup DB with Liquibase
191153

192154
Liquibase is supported. Either import all or just the required versions.
@@ -246,25 +208,6 @@ public class ExampleApplication {
246208

247209
![History](screenshots/history-screen.png)
248210

249-
## Spring Boot CSRF config for the UI
250-
251-
Axios should work with the following spring config out of the box with csrf:
252-
253-
```java
254-
@Bean
255-
SecurityFilterChain securityFilterChain(HttpSecurity http) throws Exception {
256-
http
257-
.httpBasic(org.springframework.security.config.Customizer.withDefaults())
258-
.csrf(c ->
259-
c.csrfTokenRepository(CookieCsrfTokenRepository.withHttpOnlyFalse())
260-
.csrfTokenRequestHandler(new CsrfTokenRequestAttributeHandler())
261-
);
262-
return http.build();
263-
}
264-
```
265-
266-
more informations: https://docs.spring.io/spring-security/reference/servlet/exploits/csrf.html
267-
268211
# Alternatives
269212

270213
- quartz

0 commit comments

Comments
 (0)