Пример #1
0
        /// <summary>
        /// Insert an <see cref="InException"/> based on an exception that occured during the incoming processing of an <see cref="AS4Message"/>.
        /// </summary>
        /// <param name="exception">The exception which message will be inserted.</param>
        /// <param name="ebmsMessageId">The primary message id of the <see cref="AS4Message"/> that caused the exception.</param>
        /// <param name="pmode">The PMode that was being used during the processing.</param>
        public async Task <InException> InsertIncomingAS4MessageExceptionAsync(Exception exception, string ebmsMessageId, ReceivingProcessingMode pmode)
        {
            InException entity =
                InException
                .ForEbmsMessageId(ebmsMessageId, exception)
                .SetOperationFor(pmode?.ExceptionHandling);

            await entity.SetPModeInformationAsync(pmode);

            _repository.InsertInException(entity);
            _repository.UpdateInMessage(ebmsMessageId, m => m.SetStatus(InStatus.Exception));

            return(entity);
        }
Пример #2
0
        /// <summary>
        /// Insert an <see cref="InException"/> based on an exception that occurred dring the incoming Submit operation.
        /// </summary>
        /// <param name="exception">The exception which message will be inserted.</param>
        /// <param name="submit">The original message that caused the exception.</param>
        /// <param name="pmode">The PMode that was being used during the Submit operation.</param>
        public async Task <InException> InsertIncomingSubmitExceptionAsync(
            Exception exception,
            SubmitMessage submit,
            ReceivingProcessingMode pmode)
        {
            Stream stream = await AS4XmlSerializer.ToStreamAsync(submit);

            string location = await _bodyStore.SaveAS4MessageStreamAsync(
                _config.InExceptionStoreLocation,
                stream);

            InException entity =
                InException
                .ForMessageBody(messageLocation: location, exception: exception)
                .SetOperationFor(pmode?.ExceptionHandling);

            await entity.SetPModeInformationAsync(pmode);

            _repository.InsertInException(entity);

            return(entity);
        }