fix OptimisticLockException for ack recieved before process status saved

This commit is contained in:
Efstratios Giannopoulos 2024-06-28 14:49:03 +03:00
parent 637e1cb53f
commit 9ec90d6c8d
2 changed files with 5 additions and 1 deletions

View File

@ -97,6 +97,10 @@ public class OutboxProperties {
return this.handleAckWaitInMilliSeconds;
}
public int getHandleNackWaitInMilliSeconds() {
return this.handleNackWaitInMilliSeconds;
}
public String getTenantDefaultLocaleRemovalTopic() {
return this.tenantDefaultLocaleRemovalTopic;
}

View File

@ -382,7 +382,7 @@ public class OutboxRepositoryImpl implements OutboxRepository {
} catch (OptimisticLockException ex) {
logger.warn("Problem handle nack {}. Rolling back any message emit db changes and marking error. Retrying...", nackedMessages.stream().map(UUID::toString).collect(Collectors.joining(",")));
if (transaction != null) transaction.rollback();
Thread.sleep(this.outboxProperties.getHandleNackRetries());
Thread.sleep(this.outboxProperties.getHandleNackWaitInMilliSeconds());
} catch (Exception ex) {
logger.error("Problem executing purge. rolling back any db changes and marking error. Continuing...", ex);
if (transaction != null) transaction.rollback();