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 voidprepareDownload()Checks if the date-based download logic is enabled and prepares the FederationBatchInfo Repository accordingly.voidprocessErrorFederationBatches()Downloads and processes all batches from the federation gateway that have previously been marked with the status valueFederationBatchStatus.ERROR.voidprocessUnprocessedFederationBatches()Downloads and processes all batches from the federation gateway that have previously been marked with status valueFederationBatchStatus.UNPROCESSED.protected voidsaveFirstBatchInfoForDate(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- AFederationBatchInfoServicefor accessing diagnosis key batch information.diagnosisKeyService- ADiagnosisKeyServicefor storing retrieved diagnosis keys.federationGatewayDownloadService- AFederationGatewayDownloadServicefor retrieving federation diagnosis key batches.config- ADownloadServiceConfigfor retrieving federation configuration.federationKeyValidator- AValidFederationKeyFilterfor validating keys in the downloaded batches
-
-
Method Detail
-
prepareDownload
public void prepareDownload() throws FatalFederationGatewayExceptionChecks 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 FatalFederationGatewayExceptionDownloads and processes all batches from the federation gateway that have previously been marked with status valueFederationBatchStatus.UNPROCESSED.- Throws:
FatalFederationGatewayException
-
-