Ejemplo n.º 1
0
        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)
            }));
        }
Ejemplo n.º 2
0
        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)
            }));
        }
Ejemplo n.º 3
0
        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)
            }));
        }
Ejemplo n.º 4
0
        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
            }));
        }
Ejemplo 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 });
            }
        }