Class FederationBatchProcessor
- java.lang.Object
-
- app.coronawarn.server.services.download.FederationBatchProcessor
-
@Component public class FederationBatchProcessor extends Object
Responsible for downloading and storing batch information from the federation gateway.
-
-
Constructor Summary
Constructors Constructor Description FederationBatchProcessor(FederationBatchInfoService batchInfoService, DiagnosisKeyService diagnosisKeyService, FederationGatewayDownloadService federationGatewayDownloadService, DownloadServiceConfig config, ValidFederationKeyFilter federationKeyValidator)
Constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
prepareDownload()
Checks if the date-based download logic is enabled and prepares the FederationBatchInfo Repository accordingly.void
processErrorFederationBatches()
Downloads and processes all batches from the federation gateway that have previously been marked with the status valueFederationBatchStatus.ERROR
.void
processUnprocessedFederationBatches()
Downloads and processes all batches from the federation gateway that have previously been marked with status valueFederationBatchStatus.UNPROCESSED
.protected void
saveFirstBatchInfoForDate(LocalDate date)
Stores the batch info for the specified date.
-
-
-
Constructor Detail
-
FederationBatchProcessor
public FederationBatchProcessor(FederationBatchInfoService batchInfoService, DiagnosisKeyService diagnosisKeyService, FederationGatewayDownloadService federationGatewayDownloadService, DownloadServiceConfig config, ValidFederationKeyFilter federationKeyValidator)
Constructor.- Parameters:
batchInfoService
- AFederationBatchInfoService
for accessing diagnosis key batch information.diagnosisKeyService
- ADiagnosisKeyService
for storing retrieved diagnosis keys.federationGatewayDownloadService
- AFederationGatewayDownloadService
for retrieving federation diagnosis key batches.config
- ADownloadServiceConfig
for retrieving federation configuration.federationKeyValidator
- AValidFederationKeyFilter
for validating keys in the downloaded batches
-
-
Method Detail
-
prepareDownload
public void prepareDownload() throws FatalFederationGatewayException
Checks if the date-based download logic is enabled and prepares the FederationBatchInfo Repository accordingly. The Federation Batch Info stores information about which batches have already been processed to not download them again. If the date-based download is enabled, the entries for the specified date need to be removed. Stores the first FederationBatchTag for the specified date as a starting point for further processing.- Throws:
FatalFederationGatewayException
-
saveFirstBatchInfoForDate
protected void saveFirstBatchInfoForDate(LocalDate date) throws FatalFederationGatewayException
Stores the batch info for the specified date. Its status is set toFederationBatchStatus.UNPROCESSED
.- Parameters:
date
- The date for which the first batch info is stored.- Throws:
FatalFederationGatewayException
-
processErrorFederationBatches
public void processErrorFederationBatches()
Downloads and processes all batches from the federation gateway that have previously been marked with the status valueFederationBatchStatus.ERROR
.
-
processUnprocessedFederationBatches
public void processUnprocessedFederationBatches() throws FatalFederationGatewayException
Downloads and processes all batches from the federation gateway that have previously been marked with status valueFederationBatchStatus.UNPROCESSED
.- Throws:
FatalFederationGatewayException
-
-