Jobs/Zugferd: dont move files on application errors
This commit is contained in:
parent
c8a2f4bc83
commit
96b1004749
@ -26,6 +26,8 @@ Public Class ImportZUGFeRDFiles
|
||||
Public Const ZUGFERD_ATTACHMENTS = "ZUGFeRD Attachments"
|
||||
Public HISTORY_ID As Integer
|
||||
|
||||
Private Const DIRECTORY_DONT_MOVE = "DIRECTORY_DONT_MOVE"
|
||||
|
||||
' List of allowed extensions for PDF/A Attachments
|
||||
' This list should not contain xml so the zugferd xml file will be filtered out
|
||||
Private ReadOnly AllowedExtensions As List(Of String) = New List(Of String) From {"docx", "doc", "pdf", "xls", "xlsx", "ppt", "pptx", "txt"}
|
||||
@ -406,29 +408,34 @@ Public Class ImportZUGFeRDFiles
|
||||
_logger.Error(ex)
|
||||
oTransaction.Rollback()
|
||||
|
||||
Dim oSQL = $"UPDATE TBEDM_ZUGFERD_HISTORY_IN SET COMMENT = 'REJECTED - Out of memory' WHERE GUID = '{HISTORY_ID}'"
|
||||
_firebird.ExecuteNonQuery(oSQL)
|
||||
oMoveDirectory = DIRECTORY_DONT_MOVE
|
||||
|
||||
AddRejectedState(oMessageId, "OutOfMemoryException", "", ex.Message)
|
||||
'Dim oSQL = $"UPDATE TBEDM_ZUGFERD_HISTORY_IN SET COMMENT = 'REJECTED - Out of memory' WHERE GUID = '{HISTORY_ID}'"
|
||||
'_firebird.ExecuteNonQuery(oSQL)
|
||||
'AddRejectedState(oMessageId, "OutOfMemoryException", "", ex.Message)
|
||||
|
||||
Catch ex As Exception
|
||||
_logger.Warn("Unknown Error occurred: {0}", ex.Message)
|
||||
_logger.Error(ex)
|
||||
oTransaction.Rollback()
|
||||
|
||||
Dim oSQL = $"UPDATE TBEDM_ZUGFERD_HISTORY_IN SET COMMENT = 'REJECTED - Unknown error occured' WHERE GUID = '{HISTORY_ID}'"
|
||||
_firebird.ExecuteNonQuery(oSQL)
|
||||
|
||||
oMoveDirectory = oArgs.ErrorDirectory
|
||||
|
||||
AddRejectedState(oMessageId, "UnexpectedException", "", ex.Message)
|
||||
oMoveDirectory = DIRECTORY_DONT_MOVE
|
||||
|
||||
'Dim oSQL = $"UPDATE TBEDM_ZUGFERD_HISTORY_IN SET COMMENT = 'REJECTED - Unknown error occured' WHERE GUID = '{HISTORY_ID}'"
|
||||
'_firebird.ExecuteNonQuery(oSQL)
|
||||
'oMoveDirectory = oArgs.ErrorDirectory
|
||||
'AddRejectedState(oMessageId, "UnexpectedException", "", ex.Message)
|
||||
Finally
|
||||
oConnection.Close()
|
||||
|
||||
' Move all files of the current group
|
||||
Try
|
||||
MoveFiles(oArgs, oMessageId, oFileGroupFiles, oEmailAttachmentFiles, oEmbeddedAttachmentFiles, oMoveDirectory, oIsSuccess)
|
||||
' If an application error occurred, dont move files so they will be processed again later
|
||||
If oMoveDirectory = DIRECTORY_DONT_MOVE Then
|
||||
_logger.Info("Application Error occurred. Files for message Id {0} will not be moved.", oMessageId)
|
||||
Else
|
||||
' Move all files of the current group
|
||||
MoveFiles(oArgs, oMessageId, oFileGroupFiles, oEmailAttachmentFiles, oEmbeddedAttachmentFiles, oMoveDirectory, oIsSuccess)
|
||||
End If
|
||||
_logger.Info("Finished processing file group {0}", oMessageId)
|
||||
Catch ex As Exception
|
||||
_logger.Warn("Could not move files!")
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user