Merge branch 'feature/SUPPORT-8725_refactor' into develop
This commit is contained in:
commit
676acf414c
1 changed files with 3 additions and 9 deletions
|
|
@ -78,13 +78,7 @@ public class FileUploadService {
|
||||||
|
|
||||||
try {
|
try {
|
||||||
FileUrl fileUrl = parseFileUrl(downloadRequest.fileInfo().getFileUrl());
|
FileUrl fileUrl = parseFileUrl(downloadRequest.fileInfo().getFileUrl());
|
||||||
|
|
||||||
try {
|
|
||||||
Files.createDirectories(Paths.get(fileSavingPath));
|
Files.createDirectories(Paths.get(fileSavingPath));
|
||||||
}
|
|
||||||
catch (IOException e) {
|
|
||||||
throw new RuntimeException("Failed to create directory " + fileSavingPath, e);
|
|
||||||
}
|
|
||||||
LOGGER.info("working in {}", System.getProperty("user.home"));
|
LOGGER.info("working in {}", System.getProperty("user.home"));
|
||||||
Path filePath = Paths.get(fileSavingPath, fileUrl.fileName());
|
Path filePath = Paths.get(fileSavingPath, fileUrl.fileName());
|
||||||
String downloadUrl = fileUrl.fileUrl();
|
String downloadUrl = fileUrl.fileUrl();
|
||||||
|
|
@ -131,7 +125,7 @@ public class FileUploadService {
|
||||||
Files.delete(filePath);
|
Files.delete(filePath);
|
||||||
}
|
}
|
||||||
catch (IOException e) {
|
catch (IOException e) {
|
||||||
throw new RuntimeException("Failed to delete file " + filePath.getFileName());
|
LOGGER.error("Failed to delete file " + filePath, e);
|
||||||
}
|
}
|
||||||
finally {
|
finally {
|
||||||
acknowledgment.acknowledge();
|
acknowledgment.acknowledge();
|
||||||
|
|
@ -146,7 +140,7 @@ public class FileUploadService {
|
||||||
sendMessage(inStatusTopic.name(), downloadRequest, messageId, inKafkaTemplate);
|
sendMessage(inStatusTopic.name(), downloadRequest, messageId, inKafkaTemplate);
|
||||||
acknowledgment.acknowledge();
|
acknowledgment.acknowledge();
|
||||||
}
|
}
|
||||||
catch (FileUploadException e) {
|
catch (FileUploadException | IOException e) {
|
||||||
// считаем, что нужно повторное считывание сообщения
|
// считаем, что нужно повторное считывание сообщения
|
||||||
// ошибку логируем, сообщение оставляем непрочитанным
|
// ошибку логируем, сообщение оставляем непрочитанным
|
||||||
LOGGER.error(e.getMessage(), e);
|
LOGGER.error(e.getMessage(), e);
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue