Error handling verbessert und OCI Verbindungsaufbau Problem behoben
This commit is contained in:
@@ -69,6 +69,8 @@ public class FileProcessingPipeline {
|
||||
executor.submit(() -> {
|
||||
try {
|
||||
processAll();
|
||||
} catch (Exception e) {
|
||||
Log.errorf(e, "Unerwarteter Fehler im Pipeline-Lauf");
|
||||
} finally {
|
||||
isRunning.set(false);
|
||||
}
|
||||
@@ -91,6 +93,7 @@ public class FileProcessingPipeline {
|
||||
|
||||
if (zipFiles.isEmpty()) {
|
||||
Log.info("Keine neuen ZIP-Dateien auf dem SFTP-Server gefunden");
|
||||
Log.info("Pipeline-Lauf abgeschlossen");
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -122,17 +125,24 @@ public class FileProcessingPipeline {
|
||||
Log.infof("ZIP '%s' entpackt: %d Datei(en)", zipFilename,
|
||||
context.extractedFiles.size());
|
||||
|
||||
// --- OCI Upload ---
|
||||
// --- OCI Upload (Dateien, noch kein Marker) ---
|
||||
MDC.put("step", "oci-upload");
|
||||
context.status = ProcessingStatus.PARTIALLY_UPLOADED;
|
||||
Log.info("Starte OCI-Upload");
|
||||
ociUploadService.upload(context);
|
||||
context.status = ProcessingStatus.MARKER_UPLOADED;
|
||||
ociUploadService.uploadFiles(context);
|
||||
|
||||
// --- SFTP Rename → .processed ---
|
||||
// Erst nach erfolgreichem Datei-Upload — Marker kommt danach,
|
||||
// damit Marker-Präsenz in OCI ↔ ZIP bereits .processed auf SFTP.
|
||||
MDC.put("step", "sftp-rename");
|
||||
sftpService.renameFile(zipFilename, zipFilename + ".processed");
|
||||
|
||||
// --- OCI Marker ---
|
||||
// Signalisiert der DB-Verarbeitung, dass der Batch vollständig hochgeladen ist.
|
||||
MDC.put("step", "oci-marker");
|
||||
ociUploadService.uploadMarker(context);
|
||||
context.status = ProcessingStatus.MARKER_UPLOADED;
|
||||
|
||||
// --- ORDS Notify ---
|
||||
MDC.put("step", "ords-notify");
|
||||
ordsNotificationService.triggerDbProcessing(context);
|
||||
@@ -140,14 +150,19 @@ public class FileProcessingPipeline {
|
||||
context.status = ProcessingStatus.ORDS_NOTIFIED;
|
||||
Log.infof("Verarbeitung erfolgreich abgeschlossen: '%s'", zipFilename);
|
||||
|
||||
} catch (SftpException | ZipException | OciException | OrdsException e) {
|
||||
Log.errorf(e, "Verarbeitung von '%s' fehlgeschlagen: %s", zipFilename, e.getMessage());
|
||||
} catch (ZipException e) {
|
||||
Log.errorf(e, "Ungültige ZIP-Datei '%s' — wird zu .error umbenannt", zipFilename);
|
||||
context.status = ProcessingStatus.FAILED;
|
||||
tryRenameToError(zipFilename);
|
||||
} catch (SftpException | OciException | OrdsException e) {
|
||||
Log.errorf(e, "Verarbeitung von '%s' fehlgeschlagen (Infrastruktur): %s", zipFilename, e.getMessage());
|
||||
context.status = ProcessingStatus.FAILED;
|
||||
} catch (IOException e) {
|
||||
Log.errorf(e, "I/O-Fehler bei der Verarbeitung von '%s'", zipFilename);
|
||||
context.status = ProcessingStatus.FAILED;
|
||||
tryRenameToError(zipFilename);
|
||||
} catch (RuntimeException e) {
|
||||
Log.errorf(e, "Unerwarteter Laufzeitfehler bei der Verarbeitung von '%s'", zipFilename);
|
||||
context.status = ProcessingStatus.FAILED;
|
||||
} finally {
|
||||
postProcessingCleanup(context);
|
||||
long durationSeconds = Duration.between(context.startTime, LocalDateTime.now()).toSeconds();
|
||||
|
||||
Reference in New Issue
Block a user