FINERACT-1678: Add retry limit to COB

This commit is contained in:
Adam Saghy
2023-05-10 07:51:10 +02:00
committed by Arnold Gálovics
parent b86a70397f
commit 70c93484f4
8 changed files with 123 additions and 1 deletions
@@ -93,7 +93,8 @@ public class LoanCOBWorkerConfiguration {
public Step loanBusinessStep(@Value("#{stepExecutionContext['partition']}") String partitionName) {
return localStepBuilderFactory.get("Loan Business - Step:" + partitionName)
.<Loan, Loan>chunk(propertyService.getChunkSize(JobName.LOAN_COB.name())).reader(cobWorkerItemReader())
.processor(cobWorkerItemProcessor()).writer(cobWorkerItemWriter()).faultTolerant().skip(Exception.class)
.processor(cobWorkerItemProcessor()).writer(cobWorkerItemWriter()).faultTolerant().retry(Exception.class)
.retryLimit(propertyService.getRetryLimit(LoanCOBConstant.JOB_NAME)).skip(Exception.class)
.skipLimit(propertyService.getChunkSize(JobName.LOAN_COB.name()) + 1).listener(loanItemListener()).build();
}
@@ -147,6 +147,7 @@ public class FineractProperties {
private Integer chunkSize;
private Integer partitionSize;
private Integer threadCount;
private Integer retryLimit;
}
@Getter
@@ -23,4 +23,6 @@ public interface PropertyService {
Integer getPartitionSize(String jobName);
Integer getChunkSize(String jobName);
Integer getRetryLimit(String jobName);
}
@@ -50,4 +50,15 @@ public class PropertyServiceImpl implements PropertyService {
.map(FineractProperties.PartitionedJobProperty::getChunkSize) //
.orElse(1);
}
@Override
public Integer getRetryLimit(String jobName) {
List<FineractProperties.PartitionedJobProperty> jobProperties = fineractProperties.getPartitionedJob()
.getPartitionedJobProperties();
return jobProperties.stream() //
.filter(jobProperty -> jobName.equals(jobProperty.getJobName())) //
.findFirst() //
.map(FineractProperties.PartitionedJobProperty::getRetryLimit) //
.orElse(1);
}
}
@@ -65,6 +65,7 @@ fineract.partitioned-job.partitioned-job-properties[0].job-name=LOAN_COB
fineract.partitioned-job.partitioned-job-properties[0].chunk-size=${LOAN_COB_CHUNK_SIZE:100}
fineract.partitioned-job.partitioned-job-properties[0].partition-size=${LOAN_COB_PARTITION_SIZE:100}
fineract.partitioned-job.partitioned-job-properties[0].thread-count=${LOAN_COB_THREAD_COUNT:1}
fineract.partitioned-job.partitioned-job-properties[0].retry-limit=${LOAN_COB_RETRY_LIMIT:5}
fineract.remote-job-message-handler.spring-events.enabled=${FINERACT_REMOTE_JOB_MESSAGE_HANDLER_SPRING_EVENTS_ENABLED:true}
fineract.remote-job-message-handler.jms.enabled=${FINERACT_REMOTE_JOB_MESSAGE_HANDLER_JMS_ENABLED:false}