private async Task InsertOutException(Exception exception, Stream body)
        {
            using (DatastoreContext context = _createContext())
            {
                var repository = new DatastoreRepository(context);
                var service    = new ExceptionService(_configuration, repository, _bodyStore);

                await service.InsertOutgoingExceptionAsync(exception, body);

                await context.SaveChangesAsync();
            }
        }
Beispiel #2
0
        /// <summary>
        /// Handles the transformation exception.
        /// </summary>
        /// <param name="exception">The exception.</param>
        /// <param name="messageToTransform">The <see cref="ReceivedMessage"/> that must be transformed by the transformer.</param>
        /// <returns></returns>
        public async Task <MessagingContext> HandleTransformationException(Exception exception, ReceivedMessage messageToTransform)
        {
            Logger.Error($"Exception occured during transformation: {exception.Message}");

            using (DatastoreContext db = _createContext())
            {
                var repository = new DatastoreRepository(db);
                var service    = new ExceptionService(_configuration, repository, _bodyStore);

                await service.InsertOutgoingExceptionAsync(exception, messageToTransform.UnderlyingStream);

                await db.SaveChangesAsync();
            }

            return(new MessagingContext(exception));
        }