RED-6805: As Operation I want to see why downloads are in an ERROR state
reset errorcause when downloadstatus is ready ensuring lenghth of errorcause will not exceed field length
This commit is contained in:
parent
3f6c493e54
commit
5333db97ea
@ -27,6 +27,7 @@ public class DownloadDLQMessageReceiver {
|
|||||||
private final DownloadStatusPersistenceService downloadStatusPersistenceService;
|
private final DownloadStatusPersistenceService downloadStatusPersistenceService;
|
||||||
private final RetryTemplate retryTemplate;
|
private final RetryTemplate retryTemplate;
|
||||||
private final ObjectMapper objectMapper;
|
private final ObjectMapper objectMapper;
|
||||||
|
private final static int MAX_ERROR_CAUSE_LENGTH = 1024;
|
||||||
|
|
||||||
|
|
||||||
@RabbitListener(queues = MessagingConfiguration.DOWNLOAD_COMPRESSION_DLQ)
|
@RabbitListener(queues = MessagingConfiguration.DOWNLOAD_COMPRESSION_DLQ)
|
||||||
@ -43,6 +44,7 @@ public class DownloadDLQMessageReceiver {
|
|||||||
|
|
||||||
var downloadJob = objectMapper.readValue(failedMessage.getBody(), DownloadJob.class);
|
var downloadJob = objectMapper.readValue(failedMessage.getBody(), DownloadJob.class);
|
||||||
String errorCause = failedMessage.getMessageProperties().getHeader(X_ERROR_INFO_HEADER);
|
String errorCause = failedMessage.getMessageProperties().getHeader(X_ERROR_INFO_HEADER);
|
||||||
|
errorCause = errorCause.substring(0,MAX_ERROR_CAUSE_LENGTH-1);
|
||||||
if (errorCause == null) {
|
if (errorCause == null) {
|
||||||
errorCause = "Error occured during download job!";
|
errorCause = "Error occured during download job!";
|
||||||
}
|
}
|
||||||
|
|||||||
@ -81,6 +81,10 @@ public class DownloadStatusPersistenceService {
|
|||||||
@Transactional
|
@Transactional
|
||||||
public void updateStatus(DownloadStatusEntity entity, DownloadStatusValue statusValue, long fileSize) {
|
public void updateStatus(DownloadStatusEntity entity, DownloadStatusValue statusValue, long fileSize) {
|
||||||
|
|
||||||
|
if(statusValue.equals(DownloadStatusValue.READY)) {
|
||||||
|
entity.setErrorCause("");
|
||||||
|
}
|
||||||
|
|
||||||
entity.setStatus(statusValue);
|
entity.setStatus(statusValue);
|
||||||
entity.setFileSize(fileSize);
|
entity.setFileSize(fileSize);
|
||||||
downloadStatusRepository.save(entity);
|
downloadStatusRepository.save(entity);
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user