Verified Commit f1053652 authored by Cyril Vazquez's avatar Cyril Vazquez
Browse files

Trace sending errors, suffix Reply identifiers with date

parent ddd082a1
Pipeline #6819 failed with stages
......@@ -163,7 +163,7 @@ class ArchiveDeliveryRequest extends abstractMessage
}
if (!$identifier) {
$identifier = "archiveDeliveryRequest_".date("Y-m-d-H-i-s");
$identifier = "archiveDeliveryRequest_".date("Y-m-d_H-i-s");
}
$reference = $identifier;
......@@ -285,8 +285,8 @@ class ArchiveDeliveryRequest extends abstractMessage
} catch (\Exception $e) {
$message->status = "invalid";
$this->create($message);
$operationResult = false;
$this->logValidationErrors($message, $e);
throw $e;
}
......@@ -461,8 +461,16 @@ class ArchiveDeliveryRequest extends abstractMessage
$operationResult = true;
} catch (\Exception $e) {
$message->status = "error";
$operationResult = false;
$this->update($message);
$this->lifeCycleJournalController->logEvent(
'medona/processing',
'medona/message',
$message->messageId,
$message,
false
);
throw $e;
}
......@@ -471,7 +479,7 @@ class ArchiveDeliveryRequest extends abstractMessage
'medona/message',
$message->messageId,
$message,
$operationResult
true
);
$message->status = "processed";
......
......@@ -121,7 +121,7 @@ class ArchiveDeliveryRequestReply extends abstractMessage
$message->authorizationReason = $authorizationMessage[0]->type;
}
$message->reference = $requestMessage->reference.'_Reply';
$message->reference = $requestMessage->reference.'_Reply_'.date("Y-m-d_H-i-s");
$message->requestReference = $requestMessage->reference;
$message->senderOrgRegNumber = $requestMessage->recipientOrgRegNumber;
......@@ -165,6 +165,8 @@ class ArchiveDeliveryRequestReply extends abstractMessage
$this->create($message);
$this->logValidationErrors($message, $e);
throw $e;
}
......
......@@ -58,7 +58,7 @@ class ArchiveModificationRequest extends abstractMessage
}
if (!$identifier) {
$identifier = "archiveModificationRequest_".date("Y-m-d-H-i-s");
$identifier = "archiveModificationRequest_".date("Y-m-d_H-i-s");
}
$messages = [];
......
......@@ -241,6 +241,8 @@ class ArchiveRestitution extends abstractMessage
$this->create($message);
$this->logValidationErrors($message, $e);
throw $e;
}
......@@ -298,7 +300,7 @@ class ArchiveRestitution extends abstractMessage
$archiveRestitutionRequestController = \laabs::newController("medona/ArchiveRestitutionRequest");
if (!$identifier) {
$identifier = "archiveRestitutionRequest_".date("Y-m-d-H-i-s");
$identifier = "archiveRestitutionRequest_".date("Y-m-d_H-i-s");
}
$reference = $identifier;
......
......@@ -217,7 +217,8 @@ class ArchiveRestitutionRequest extends abstractMessage
} catch (\Exception $e) {
$message->status = "invalid";
$this->create($message);
$operationResult = false;
$this->logValidationErrors($message, $e);
throw $e;
}
......@@ -283,7 +284,8 @@ class ArchiveRestitutionRequest extends abstractMessage
} catch (\Exception $e) {
$message->status = "invalid";
$this->create($message);
$operationResult = false;
$this->logValidationErrors($message, $e);
throw $e;
}
......
......@@ -56,7 +56,7 @@ class ArchiveRestitutionRequestReply extends abstractMessage
$message->comment[] = $comment;
}
$message->reference = $requestMessage->reference.'_Reply';
$message->reference = $requestMessage->reference.'_Reply_'.date("Y-m-d_H-i-s");
$message->requestReference = $requestMessage->reference;
$requestMessage->replyReference = $message->reference;
......@@ -91,13 +91,12 @@ class ArchiveRestitutionRequestReply extends abstractMessage
$this->save($message);
}
$operationResult = true;
} catch (\Exception $e) {
$message->status = "invalid";
$operationResult = false;
$this->create($message);
$this->logValidationErrors($message, $e);
throw $e;
}
......
......@@ -54,7 +54,7 @@ class ArchiveTransferReply extends abstractMessage
$message->receptionDate = $message->date;
$message->replyCode = $replyCode;
$message->reference = $transferMessage->reference.'_Reply';
$message->reference = $transferMessage->reference.'_Reply_'.date("Y-m-d_H-i-s");
$lifeCycleEvents = $this->lifeCycleJournalController->getObjectEvents($transferMessage->messageId, 'medona/message');
foreach ($lifeCycleEvents as $lifeCycleEvent) {
......
......@@ -155,7 +155,7 @@ class ArchiveTransferSending extends abstractMessage
if (!empty($archives)) {
if (!$identifier) {
$identifier = "archiveTransfer_".date("Y-m-d-H-i-s");
$identifier = "archiveTransfer_".date("Y-m-d_H-i-s");
}
$reference = $identifier;
......@@ -239,7 +239,8 @@ class ArchiveTransferSending extends abstractMessage
} catch (\Exception $e) {
$message->status = "invalid";
$this->create($message);
$operationResult = false;
$this->logValidationErrors($message, $e);
throw $e;
}
......
......@@ -55,7 +55,7 @@ class AuthorizationControlAuthorityRequestReply extends abstractMessage
$message->comment[] = $comment;
}
$message->reference = $requestMessage->reference.'_Reply';
$message->reference = $requestMessage->reference.'_Reply_'.date("Y-m-d_H-i-s");
$message->requestReference = $requestMessage->reference;
$requestMessage->replyReference = $requestMessage->reference;
......@@ -67,7 +67,6 @@ class AuthorizationControlAuthorityRequestReply extends abstractMessage
if ($message->schema != 'medona') {
$authorizationControlAuthorityRequestReplyController = \laabs::newController($message->schema.'/AuthorizationControlAuthorityRequestReply');
$authorizationControlAuthorityRequestReplyController->send($message);
} else {
$authorizationControlAuthorityRequestReply = $this->sendMessage($message);
$message->object = $authorizationControlAuthorityRequestReply;
......@@ -79,11 +78,13 @@ class AuthorizationControlAuthorityRequestReply extends abstractMessage
$this->generate($message);
$this->save($message);
}
$operationResult = true;
} catch (\Exception $e) {
$message->status = "invalid";
$operationResult = false;
$this->create($message);
$this->logValidationErrors($message, $e);
throw $e;
}
$this->lifeCycleJournalController->logEvent(
......@@ -91,7 +92,7 @@ class AuthorizationControlAuthorityRequestReply extends abstractMessage
'medona/message',
$message->messageId,
$message,
$operationResult
true
);
$this->create($message);
......
......@@ -83,10 +83,12 @@ class AuthorizationOriginatingAgencyRequest extends AuthorizationRequest
$this->generate($message);
$this->save($message);
}
$operationResult = true;
} catch (\Exception $e) {
$message->status = "invalid";
$operationResult = false;
$this->create($message);
$this->logValidationErrors($message, $e);
throw $e;
}
$this->lifeCycleJournalController->logEvent(
......
......@@ -52,7 +52,7 @@ class AuthorizationOriginatingAgencyRequestReply extends abstractMessage
$message->comment[] = $comment;
}
$message->reference = $requestMessage->reference.'_Reply';
$message->reference = $requestMessage->reference.'_Reply_'.date("Y-m-d_H-i-s");
$message->requestReference = $requestMessage->reference;
$message->authorizationReason = $requestMessage->authorizationReason;
$requestMessage->replyReference = $message->reference;
......@@ -97,6 +97,11 @@ class AuthorizationOriginatingAgencyRequestReply extends abstractMessage
$this->update($requestMessage);
} catch (\Exception $e) {
$message->status = "invalid";
$this->create($message);
$this->logValidationErrors($message, $e);
throw $e;
}
$this->create($message);
......
......@@ -74,7 +74,7 @@ class AuthorizationRequestReply extends abstractMessage
$message->date = \laabs::newDatetime(null, "UTC");
$message->receptionDate = $message->date;
$message->reference = $requestMessage->reference.'_Reply';
$message->reference = $requestMessage->reference.'_Reply_'.date("Y-m-d_H-i-s");
$message->requestReference = $requestMessage->reference;
$requestMessage->replyReference = $message->reference;
......@@ -91,6 +91,10 @@ class AuthorizationRequestReply extends abstractMessage
$this->update($requestMessage);
} catch (\Exception $e) {
$message->status = "invalid";
$this->create($message);
$this->logValidationErrors($message, $e);
throw $e;
}
$this->create($message);
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment