Reputation: 1246
I'm using spring-batch
to process something.
(Now I'm just using tasklet
.)
Now I have to make api that shows result of batch jobs.
result is like below,
executor | job name | status | success count | fail count
ㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡ
joont92 | some_job | FAIL | 100 | 20
As you guys know,
job name
is JOB_INSTACE
's data,
status
is JOB_EXECUTION
's data,
success count
, fail count
is STEP_EXECUTION
's data.
And executor
is JOB_EXECUTION_CONTEXT
's data maybe.
Yeah, I need tojoin
spring-batch
's tables. But I don't know how I have to do.
I've found JobExplorer
, JobRepository
.
It seems like to select spring-batch
's tables, but I'm not sure this is right way to make result api.
Is there any libraries or way to do this?
Have to use another spring
's library?
Upvotes: 0
Views: 278
Reputation: 31730
Is there any libraries or way to do this?
JobExplorer
is the way to go. It is a read-only version of the job repository which is perfectly fine for your use case.
Have to use another spring's library?
If you don't want to use the JobExplorer
form Spring Batch, you can query the database with:
JdbcTemplate
. You can find a getting started guide about it here: https://spring.io/guides/gs/relational-data-access/ Hope this helps.
Upvotes: 1