/// <summary> /// Responds to a stored request with a fault. /// </summary> /// <typeparam name="TInstance"></typeparam> /// <typeparam name="TData"></typeparam> /// <typeparam name="TRequest"></typeparam> /// <param name="source"></param> /// <param name="requestTokenFactory"></param> /// <param name="exception"></param> /// <param name="contextCallback"></param> /// <returns></returns> public static EventActivityBinder <TInstance, TData> FaultedTo <TInstance, TData, TRequest>(this EventActivityBinder <TInstance, TData> source, RequestTokenFactory <TInstance, TData, TRequest> requestTokenFactory, Exception exception, Action <SendContext <FaultEvent <TRequest> > > contextCallback = null) where TInstance : class, SagaStateMachineInstance where TData : class where TRequest : class { return(source.Add(new FaultedToActivity <TInstance, TData, TRequest>(context => Task.FromResult(requestTokenFactory(context)), context => Task.FromResult(exception), contextCallback))); }
/// <summary> /// Responds to the previosly captured request token. /// </summary> /// <typeparam name="TInstance"></typeparam> /// <typeparam name="TData"></typeparam> /// <typeparam name="TRequest"></typeparam> /// <typeparam name="TResponse"></typeparam> /// <param name="source"></param> /// <param name="requestTokenFactory"></param> /// <param name="message"></param> /// <param name="contextCallback"></param> /// <returns></returns> public static EventActivityBinder <TInstance, TData> RespondTo <TInstance, TData, TRequest, TResponse>(this EventActivityBinder <TInstance, TData> source, RequestTokenFactory <TInstance, TData, TRequest> requestTokenFactory, TResponse message, Action <SendContext <TResponse> > contextCallback = null) where TInstance : class, SagaStateMachineInstance where TData : class where TRequest : class where TResponse : class { return(source.Add(new RespondToActivity <TInstance, TData, TRequest, TResponse>(context => Task.FromResult(requestTokenFactory(context)), context => Task.FromResult(message), contextCallback))); }