/// <summary> /// Initializes a new instance of the <see cref="PullSendAgentExceptionHandler" /> class. /// </summary> /// <param name="createContext">The create context.</param> /// <param name="configuration"></param> /// <param name="bodyStore"></param> public PullSendAgentExceptionHandler( Func <DatastoreContext> createContext, IConfig configuration, IAS4MessageBodyStore bodyStore) { if (createContext == null) { throw new ArgumentNullException(nameof(createContext)); } if (configuration == null) { throw new ArgumentNullException(nameof(configuration)); } if (bodyStore == null) { throw new ArgumentNullException(nameof(bodyStore)); } _createContext = createContext; _configuration = configuration; _bodyStore = bodyStore; _outboundExceptionHandler = new OutboundExceptionHandler(createContext, configuration, bodyStore); }
/// <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) { var entity = GetReceivedEntity(messageToTransform); if (entity is InMessage || entity is InException) { var inboundHandler = new InboundExceptionHandler(); return(await inboundHandler.HandleTransformationException(exception, messageToTransform).ConfigureAwait(false)); } else { var outboundHandler = new OutboundExceptionHandler(); return(await outboundHandler.HandleTransformationException(exception, messageToTransform).ConfigureAwait(false)); } }