use of org.folio.service.holdings.message.LoadFailedMessage in project mod-kb-ebsco-java by folio-org.
the class HoldingsServiceImpl method loadingFailed.
@Override
public void loadingFailed(LoadFailedMessage message) {
final UUID credentialsId = toUUID(message.getCredentialsId());
final String tenantId = message.getTenantId();
setStatusToFailed(credentialsId, tenantId, message.getErrorMessage()).thenAccept(o -> retryAfterDelayIfAttemptsLeft(message.getCredentialsId(), tenantId, loadHoldingsRetryDelay, o2 -> executeWithLock(START_LOADING_LOCK, () -> {
final Integer totalCount = message.getTotalCount();
final Integer totalPages = message.getTotalPages();
return tryChangingStatusToInProgress(getStatusLoadingHoldings(totalCount, 0, totalPages, 0), credentialsId, tenantId).thenCompose(o3 -> transactionIdRepository.getLastTransactionId(credentialsId, tenantId).thenAccept(previousTransactionId -> loadServiceFacade.loadHoldings(getLoadHoldingsMessage(message, previousTransactionId)))).exceptionally(e -> {
logger.error(FAILED_RETRY_LOADING_HOLDINGS_MESSAGE, e);
return null;
});
})));
}
Aggregations