Spring Batch – Programmatic Flow Decision
springbatch
9
programmatic
1
decision
1
Male avatar

loveprogramming viết ngày 26/04/2021

https://grokonez.com/spring-framework/spring-batch/spring-batch-programmatic-flow-decision

Spring Batch – Programmatic Flow Decision

In the article, JavaSampleApproach will introduce about Programmatic Flow Decisions in Spring Batch.

Related Post: Spring Batch

A. Concept

Spring Batch provides mechanics for controlling the flow steps of batch job: JobExecutionDecider interface & decision tag

1. JobExecutionDecider

The interface allowing for programmatic access to the decision on what the status of a flow should be.
In here we need overwrite the function: FlowExecutionStatus decide(JobExecution jobExecution, StepExecution stepExecution): Strategy for branching an execution based on the state of an ongoing. The return value will be used as a status to determine the next step in the job.


package org.springframework.batch.core.job.flow;

import org.springframework.batch.core.JobExecution;
import org.springframework.batch.core.StepExecution;

/**
 * Interface allowing for programmatic access to the decision on what the status
 * of a flow should be.  For example, if some condition that's stored in the 
 * database indicates that the job should stop for a manual check, a decider
 * implementation could check that value to determine the status of the flow. 
 * 
 * @author Dave Syer
 * @since 2.0
 */
public interface JobExecutionDecider {

    /**
     * Strategy for branching an execution based on the state of an ongoing
     * {@link JobExecution}. The return value will be used as a status to
     * determine the next step in the job.
     * 
     * @param jobExecution a job execution
     * @param stepExecution the latest step execution (may be null)
     * @return the exit status code
     */
    FlowExecutionStatus decide(JobExecution jobExecution, StepExecution stepExecution);

}

2. "decision" tag

"decision" tag specify the decider to use as well as all of the transitions
Example:

More at:

https://grokonez.com/spring-framework/spring-batch/spring-batch-programmatic-flow-decision

Spring Batch – Programmatic Flow Decision

Bình luận


White
{{ comment.user.name }}
Bỏ hay Hay
{{comment.like_count}}
Male avatar
{{ comment_error }}
Hủy
   

Hiển thị thử

Chỉnh sửa

Male avatar

loveprogramming

451 bài viết.
79 người follow
Kipalog
{{userFollowed ? 'Following' : 'Follow'}}
Cùng một tác giả
Male avatar
1 0
Tutorial Link: (Link) (Ảnh) Django is a Pythonbased free and opensource web framework that follows the modeltemplateview architectural pattern. A...
loveprogramming viết 6 tháng trước
1 0
Male avatar
1 0
https://loizenai.com/angular11nodejspostgresqlcrudexample/ Angular 11 Node.js PostgreSQL Crud Example (Ảnh) Tutorial: “Angular 11 Node.js Postg...
loveprogramming viết 5 tháng trước
1 0
Male avatar
1 0
Angular Spring Boot jwt Authentication Example Github https://loizenai.com/angularspringbootjwt/ (Ảnh) Tutorial: ” Angular Spring Boot jwt Authe...
loveprogramming viết 5 tháng trước
1 0
Bài viết liên quan
Male avatar
0 0
https://grokonez.com/springframework/springbatch/configurespringbatchsteprestart How to configure Spring Batch Step for restart In How to use Spr...
loveprogramming viết 18 ngày trước
0 0
{{like_count}}

kipalog

{{ comment_count }}

bình luận

{{liked ? "Đã kipalog" : "Kipalog"}}


Male avatar
{{userFollowed ? 'Following' : 'Follow'}}
451 bài viết.
79 người follow

 Đầu mục bài viết

Vẫn còn nữa! x

Kipalog vẫn còn rất nhiều bài viết hay và chủ đề thú vị chờ bạn khám phá!