You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
REST API for <ahref="https://spring.io/projects/spring-batch">Spring Batch</a> based on <ahref="https://github.com/spring-projects/spring-boot">Spring Boot 2.2</a> and <ahref="https://github.com/spring-projects/spring-hateoas">Spring HATOEAS</a>. It comes with an OpenAPI 3 documentation provided by <ahref="https://github.com/springdoc/springdoc-openapi">Springdoc</a>.
10
10
11
-
Supports Java 8 and above. Tested on OpenJDK 8, 11, and 14.
11
+
Supports Java 8 and above. Tested on OpenJDK 8and 11.
12
12
13
13
## Features
14
14
- Get information on jobs, job executions, and Quartz schedules
15
15
- Start job execution (synchronous or asynchronous) with optional job property overrides. The job properties can
16
16
either be obtained via a custom API or via standard Spring Batch job parameters, accessible from <ahref="https://docs.spring.io/spring-batch/trunk/apidocs/org/springframework/batch/core/scope/StepScope.html">step-scoped beans</a>.
17
17
18
-
## Live Demo
19
-
20
-
Check out the <ahref="https://spring-batch-rest.herokuapp.com/swagger-ui.html">live demo</a> of this project's Swagger UI. This demo is automatically updated whenever the repo's master branch changes. Please note that it may take up to 30s for this Heroku app to perform a cold start after it has not been used for a while.
21
-
22
-
Here's how to run a <ahref="https://github.com/chrisgleissner/spring-batch-rest/tree/master/example/api/src/main/java/com/github/chrisgleissner/springbatchrest/example/core/PersonJobConfig.java">sample job<a>:
23
-
* Click on `Spring Batch Job Executions`, then on `POST`. Now click on `Try it Out` on the right-hand side. Replace the contents of the `Example Value` input field with `{"name": "personJob"}` and press `Execute`.
24
-
* The job has now been triggered. When it completes, you'll get a response body similar to:
* You can now view this and other recently completed jobs via the <ahref="https://spring-batch-rest.herokuapp.com/jobExecutions?jobName=personJob&limitPerJob=3">job execution overview<a>:
46
-
```
47
-
{
48
-
"_embedded": {
49
-
"jobExecutionResourceList": [
50
-
{
51
-
"jobExecution": {
52
-
"id": 1,
53
-
"jobId": 1,
54
-
"jobName": "personJob",
55
-
...
56
-
```
57
-
58
18
## Getting Started
59
19
60
20
To integrate the REST API in your Spring Boot project, first ensure you have an entry point to your application such as
Here's how to run a [sample job](https://github.com/chrisgleissner/spring-batch-rest/tree/master/example/api/src/main/java/com/github/chrisgleissner/springbatchrest/example/core/PersonJobConfig.java), assuming
89
+
you've started the API as described above:
90
+
91
+
* Click on `POST` to the left of `/jobExecutions`, then on `Try it Out` on the right-hand side. Replace the contents of the `Request body` with `{"name": "personJob"}`, then click `Execute`.
92
+
* The job has now been triggered. When it completes, you'll get a response body similar to:
93
+
```
94
+
{
95
+
"jobExecution": {
96
+
"id": 0,
97
+
"jobId": 0,
98
+
"jobName": "personJob",
99
+
"startTime": "2023-09-01T19:01:55.264",
100
+
"endTime": "2023-09-01T19:01:55.317",
101
+
"exitCode": "COMPLETED",
102
+
"exitDescription": "",
103
+
"status": "COMPLETED",
104
+
"exceptions": []
105
+
},
106
+
"_links": {
107
+
"self": {
108
+
"href": "http://localhost:8080/jobExecutions/0"
109
+
}
110
+
}
111
+
}
112
+
```
113
+
* You can now view this and other recently completed jobs by clicking on `GET` to the left of `/jobExecutions`, then on `Try it Out` followed by `Execute`. You should see something like:
0 commit comments