Package ca.uhn.fhir.jpa.batch.reader
Class CronologicalBatchAllResourcePidReader
java.lang.Object
ca.uhn.fhir.jpa.batch.reader.CronologicalBatchAllResourcePidReader
- All Implemented Interfaces:
org.springframework.batch.item.ItemReader<List<Long>>
,org.springframework.batch.item.ItemStream
public class CronologicalBatchAllResourcePidReader
extends Object
implements org.springframework.batch.item.ItemReader<List<Long>>, org.springframework.batch.item.ItemStream
This Spring Batch reader takes 3 parameters:
JOB_PARAM_BATCH_SIZE
: The number of resources to return with each search.
JOB_PARAM_START_TIME
: The latest timestamp of resources to search for
JOB_PARAM_REQUEST_PARTITION
: (optional) The partition of resources to read
The reader will return at most JOB_PARAM_BATCH_SIZE
pids every time it is called, or null
once no more matching resources are available. It returns the resources in reverse chronological order
appended with "." and the index number of the url list item it has gotten up to. This is to permit
restarting jobs that use this reader so it can pick up where it left off.
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic org.springframework.batch.core.JobParameters
buildJobParameters
(Integer theBatchSize, ca.uhn.fhir.interceptor.model.RequestPartitionId theRequestPartitionId) void
close()
void
open
(org.springframework.batch.item.ExecutionContext executionContext) read()
void
setBatchSize
(Integer theBatchSize) void
setRequestPartitionId
(String theRequestPartitionIdJson) void
setStartTime
(Date theStartTime) void
update
(org.springframework.batch.item.ExecutionContext executionContext)
-
Field Details
-
JOB_PARAM_BATCH_SIZE
- See Also:
-
JOB_PARAM_START_TIME
- See Also:
-
JOB_PARAM_REQUEST_PARTITION
- See Also:
-
CURRENT_THRESHOLD_LOW
- See Also:
-
-
Constructor Details
-
CronologicalBatchAllResourcePidReader
-
-
Method Details
-
setBatchSize
@Autowired public void setBatchSize(@Value("#{jobParameters[\'batch-size\']}") Integer theBatchSize) -
setStartTime
-
buildJobParameters
public static org.springframework.batch.core.JobParameters buildJobParameters(Integer theBatchSize, ca.uhn.fhir.interceptor.model.RequestPartitionId theRequestPartitionId) -
read
-
open
public void open(org.springframework.batch.item.ExecutionContext executionContext) throws org.springframework.batch.item.ItemStreamException - Specified by:
open
in interfaceorg.springframework.batch.item.ItemStream
- Throws:
org.springframework.batch.item.ItemStreamException
-
update
public void update(org.springframework.batch.item.ExecutionContext executionContext) throws org.springframework.batch.item.ItemStreamException - Specified by:
update
in interfaceorg.springframework.batch.item.ItemStream
- Throws:
org.springframework.batch.item.ItemStreamException
-
close
- Specified by:
close
in interfaceorg.springframework.batch.item.ItemStream
- Throws:
org.springframework.batch.item.ItemStreamException
-
setRequestPartitionId
@Autowired public void setRequestPartitionId(@Value("#{jobParameters[\'request-partition\']}") String theRequestPartitionIdJson) throws com.fasterxml.jackson.core.JsonProcessingException - Throws:
com.fasterxml.jackson.core.JsonProcessingException
-