Ejemplo n.º 1
0
        /// <summary>
        /// Send a request to the configured service endpoint, and setup the state machine to accept the response.
        /// </summary>
        /// <typeparam name="TInstance">The state instance type</typeparam>
        /// <typeparam name="TRequest">The request message type</typeparam>
        /// <typeparam name="TResponse">The response message type</typeparam>
        /// <param name="binder">The event binder</param>
        /// <param name="request">The configured request to use</param>
        /// <param name="messageFactory">The request message factory</param>
        /// <returns></returns>
        public static EventActivityBinder <TInstance> Request <TInstance, TRequest, TResponse>(this EventActivityBinder <TInstance> binder,
                                                                                               Request <TInstance, TRequest, TResponse> request, AsyncEventMessageFactory <TInstance, TRequest> messageFactory)
            where TInstance : class, SagaStateMachineInstance
            where TRequest : class
            where TResponse : class
        {
            ScheduleTokenId.UseTokenId <RequestTimeoutExpired <TRequest> >(x => x.RequestId);
            var activity = new RequestActivity <TInstance, TRequest, TResponse>(request, messageFactory);

            return(binder.Add(activity));
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Send a request to the configured service endpoint, and setup the state machine to accept the response.
        /// </summary>
        /// <typeparam name="TInstance">The state instance type</typeparam>
        /// <typeparam name="TRequest">The request message type</typeparam>
        /// <typeparam name="TResponse">The response message type</typeparam>
        /// <typeparam name="TException"></typeparam>
        /// <param name="binder">The event binder</param>
        /// <param name="request">The configured request to use</param>
        /// <param name="messageFactory">The request message factory</param>
        /// <returns></returns>
        public static ExceptionActivityBinder <TInstance, TException> Request <TInstance, TException, TRequest, TResponse>(
            this ExceptionActivityBinder <TInstance, TException> binder, Request <TInstance, TRequest, TResponse> request,
            EventExceptionMessageFactory <TInstance, TException, TRequest> messageFactory)
            where TInstance : class, SagaStateMachineInstance
            where TRequest : class
            where TResponse : class
            where TException : Exception
        {
            ScheduleTokenId.UseTokenId <RequestTimeoutExpired <TRequest> >(x => x.RequestId);
            var activity = new FaultedRequestActivity <TInstance, TException, TRequest, TResponse>(request, messageFactory);

            return(binder.Add(activity));
        }
Ejemplo n.º 3
0
 public Specifying_an_event_reschedule_if_exists()
 {
     ScheduleTokenId.UseTokenId <A>(x => x.Id);
 }
Ejemplo n.º 4
0
 static RequestExtensions()
 {
     ScheduleTokenId.UseTokenId <RequestTimeoutExpired>(x => x.RequestId);
 }