public Task NotifyCanceled(string reason = null)
        {
            LogContext.Debug?.Log("Job Canceled: {JobId} {AttemptId} ({RetryAttempt})", JobId, AttemptId, RetryAttempt);

            return(Notify <JobAttemptCanceled>(new
            {
                JobId,
                AttemptId,
                RetryAttempt,
                InVar.Timestamp,
                Job = SerializerCache.GetObjectAsDictionary(Job)
            }));
        }
        public Task NotifyCompleted()
        {
            LogContext.Debug?.Log("Job Completed: {JobId} {AttemptId} ({RetryAttempt})", JobId, AttemptId, RetryAttempt);

            return(Notify <JobAttemptCompleted>(new
            {
                JobId,
                AttemptId,
                RetryAttempt,
                InVar.Timestamp,
                Duration = ElapsedTime,
                Job = SerializerCache.GetObjectAsDictionary(Job)
            }));
        }
        public Task NotifyStarted()
        {
            LogContext.Debug?.Log("Job Started: {JobId} {AttemptId} ({RetryAttempt})", JobId, AttemptId, RetryAttempt);

            return(Notify <JobAttemptStarted>(new
            {
                JobId,
                AttemptId,
                RetryAttempt,
                InVar.Timestamp,
                InstanceAddress = _instanceAddress,
                Job = SerializerCache.GetObjectAsDictionary(Job)
            }));
        }
        public Task NotifyFaulted(Exception exception, TimeSpan?delay)
        {
            LogContext.Debug?.Log(exception, "Job Faulted: {JobId} {AttemptId} ({RetryAttempt})", JobId, AttemptId, RetryAttempt);

            return(Notify <JobAttemptFaulted>(new
            {
                JobId,
                AttemptId,
                RetryAttempt,
                RetryDelay = delay,
                InVar.Timestamp,
                Job = SerializerCache.GetObjectAsDictionary(Job),
                Exceptions = exception
            }));
        }
Esempio n. 5
0
        async Task PublishJobSubmitted(ConsumeContext context, Guid jobId, TJob job, DateTime timestamp)
        {
            await context.Publish <JobSubmitted>(new
            {
                JobId     = jobId,
                JobTypeId = _jobTypeId,
                Timestamp = timestamp,
                Job       = SerializerCache.GetObjectAsDictionary(job),
                _options.JobTimeout
            });

            if (context.RequestId.HasValue && context.ResponseAddress != null)
            {
                await context.RespondAsync <JobSubmissionAccepted>(new { JobId = jobId });
            }
        }