public static EventActivityBinder <JobSaga> SendJobSlotReleased(this EventActivityBinder <JobSaga> binder, Uri destinationAddress) { return(binder.SendAsync(destinationAddress, context => context.Init <JobSlotReleased>(new { JobId = context.Instance.CorrelationId, context.Instance.JobTypeId }))); }
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)); }
public static EventActivityBinder <JobSaga> SendJobSlotReleased(this EventActivityBinder <JobSaga> binder, JobStateMachine machine) { return(binder.SendAsync(context => machine.JobTypeSagaEndpointAddress, context => context.Init <JobSlotReleased>(new { JobId = context.Instance.CorrelationId, context.Instance.JobTypeId }))); }
public static EventActivityBinder <JobAttemptSaga, StartJobAttempt> SendStartJob(this EventActivityBinder <JobAttemptSaga, StartJobAttempt> binder) { return(binder.SendAsync(context => context.Instance.ServiceAddress, context => context.Init <StartJob>(new { context.Data.JobId, context.Data.AttemptId, context.Data.RetryAttempt, context.Data.Job }))); }
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")))); }
public static EventActivityBinder <JobAttemptSaga, StartJobAttempt> SendStartJob(this EventActivityBinder <JobAttemptSaga, StartJobAttempt> binder, JobAttemptStateMachine machine) { return(binder.SendAsync(context => context.Instance.ServiceAddress, context => context.Init <StartJob>(new { context.Data.JobId, context.Data.AttemptId, context.Data.RetryAttempt, context.Data.Job }), context => context.ResponseAddress = machine.JobAttemptSagaEndpointAddress)); }
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 }))); }
public static EventActivityBinder <JobSaga, T> RequestJobSlot <T>(this EventActivityBinder <JobSaga, T> binder, JobStateMachine machine) where T : class { return(binder.SendAsync(machine.JobTypeSagaEndpointAddress, context => context.Init <AllocateJobSlot>(new { JobId = context.Instance.CorrelationId, context.Instance.JobTypeId, context.Instance.JobTimeout }), context => context.ResponseAddress = machine.JobSagaEndpointAddress) .TransitionTo(machine.AllocatingJobSlot)); }
public static EventActivityBinder <JobSaga, JobSlotAllocated> RequestStartJob(this EventActivityBinder <JobSaga, JobSlotAllocated> binder, JobStateMachine machine) { return(binder.SendAsync(machine.JobAttemptSagaEndpointAddress, context => context.Init <StartJobAttempt>(new { context.Data.JobId, context.Instance.AttemptId, context.Instance.ServiceAddress, context.Instance.RetryAttempt, context.Instance.Job }), context => context.ResponseAddress = machine.JobSagaEndpointAddress) .TransitionTo(machine.StartingJobAttempt)); }
public static EventActivityBinder <JobSaga> SendJobSlotReleased(this EventActivityBinder <JobSaga> binder, JobStateMachine machine, JobSlotDisposition disposition) { return(binder.SendAsync(context => machine.JobTypeSagaEndpointAddress, context => context.Init <JobSlotReleased>(new { JobId = context.Instance.CorrelationId, context.Instance.JobTypeId, Disposition = disposition == JobSlotDisposition.Faulted && context.Instance.Reason.Contains("(Suspect)") ? JobSlotDisposition.Suspect : disposition }))); }
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.")) }))); }
public static EventActivityBinder <JobSaga, JobAttemptCompleted> NotifyJobCompleted(this EventActivityBinder <JobSaga, JobAttemptCompleted> binder) { return(binder.SendAsync(context => context.Instance.ServiceAddress, context => context.Init <CompleteJob>(new { JobId = context.Instance.CorrelationId, context.Instance.Job, context.Data.Timestamp, Duration = context.Data.Timestamp - context.Instance.Started ?? TimeSpan.Zero })).PublishAsync(context => context.Init <JobCompleted>(new { JobId = context.Instance.CorrelationId, context.Instance.Job, context.Data.Timestamp, context.Data.Duration }))); }
public static EventActivityBinder <JobSaga, Fault <StartJobAttempt> > NotifyJobFaulted(this EventActivityBinder <JobSaga, Fault <StartJobAttempt> > binder) { return(binder.SendAsync(context => context.Instance.ServiceAddress, context => context.Init <FaultJob>(new { JobId = context.Instance.CorrelationId, context.Instance.Job, context.Instance.AttemptId, context.Instance.RetryAttempt, context.Data.Exceptions, Duration = context.Data.Timestamp - context.Instance.Started })).PublishAsync(context => context.Init <JobFaulted>(new { JobId = context.Instance.CorrelationId, context.Instance.Job, context.Data.Exceptions, context.Data.Timestamp, Duration = context.Data.Timestamp - context.Instance.Started }))); }