예제 #1
0
 public static EventActivityBinder <JobAttemptSaga, Fault <StartJob> > SendJobAttemptFaulted(
     this EventActivityBinder <JobAttemptSaga, Fault <StartJob> > binder, JobAttemptStateMachine machine)
 {
     return(binder.SendAsync(context => machine.JobSagaEndpointAddress, context => context.Init <JobAttemptFaulted>(new
     {
         context.Instance.JobId,
         AttemptId = context.Instance.CorrelationId,
         context.Instance.RetryAttempt,
         context.Data.Timestamp,
         context.Data.Exceptions
     })));
 }
예제 #2
0
 public static EventActivityBinder <JobAttemptSaga, T> SendJobAttemptFaulted <T>(this EventActivityBinder <JobAttemptSaga, T> binder,
                                                                                 JobAttemptStateMachine machine)
     where T : class
 {
     return(binder.SendAsync(context => machine.JobSagaEndpointAddress, context => context.Init <JobAttemptFaulted>(new
     {
         context.Instance.JobId,
         AttemptId = context.Instance.CorrelationId,
         context.Instance.RetryAttempt,
         InVar.Timestamp,
         RetryDelay = context.Instance.RetryAttempt < machine.SuspectJobRetryCount ? machine.SuspectJobRetryDelay : default(TimeSpan?),
         Exceptions = new FaultExceptionInfo(new TimeoutException("The job status check timed out."))
     })));
 }
예제 #3
0
 public static EventActivityBinder <JobAttemptSaga, T> ScheduleJobStatusCheck <T>(this EventActivityBinder <JobAttemptSaga, T> binder,
                                                                                  JobAttemptStateMachine machine)
     where T : class
 {
     return(binder.Schedule(machine.StatusCheckRequested, x => x.Init <JobStatusCheckRequested>(new { AttemptId = x.Instance.CorrelationId })));
 }
예제 #4
0
 public static EventActivityBinder <JobAttemptSaga, JobStatusCheckRequested> SendCheckJobStatus(this EventActivityBinder <JobAttemptSaga,
                                                                                                                          JobStatusCheckRequested> binder, JobAttemptStateMachine machine)
 {
     return(binder.SendAsync(context => context.Instance.InstanceAddress ?? context.Instance.ServiceAddress,
                             context => context.Init <GetJobAttemptStatus>(new
     {
         context.Instance.JobId,
         AttemptId = context.Instance.CorrelationId
     }), context => context.ResponseAddress = machine.JobAttemptSagaEndpointAddress)
            .Catch <Exception>(ex => ex.Then(context => LogContext.Error?.Log(context.Exception, "Failed sending GetJobAttemptStatus"))));
 }
예제 #5
0
 public static EventActivityBinder <JobAttemptSaga, StartJobAttempt> SendStartJob(this EventActivityBinder <JobAttemptSaga, StartJobAttempt> binder,
                                                                                  JobAttemptStateMachine machine)
 {
     return(binder.SendAsync(context => context.Instance.InstanceAddress ?? context.Instance.ServiceAddress,
                             context => context.Init <StartJob>(new
     {
         context.Data.JobId,
         context.Data.AttemptId,
         context.Data.RetryAttempt,
         context.Data.Job,
         context.Data.JobTypeId,
     }), context => context.ResponseAddress = machine.JobAttemptSagaEndpointAddress));
 }
예제 #6
0
 public static EventActivityBinder <JobAttemptSaga, JobStatusCheckRequested> SendCheckJobStatus(this EventActivityBinder <JobAttemptSaga,
                                                                                                                          JobStatusCheckRequested> binder, JobAttemptStateMachine machine)
 {
     return(binder.SendAsync(context => context.Instance.ServiceAddress, context => context.Init <GetJobAttemptStatus>(new
     {
         context.Instance.JobId,
         AttemptId = context.Instance.CorrelationId
     }), context => context.ResponseAddress = machine.JobAttemptSagaEndpointAddress));
 }