public void OnCreated(CreatedContext filterContext) { logger.Info( "创建任务 `{0}` id为 `{1}`", filterContext.Job.Method.Name, filterContext.BackgroundJob?.Id); }
public void OnCreated(CreatedContext context) { _hangfireLogger.InfoFormat( "Job that is based on method {0} has been created with id {1}", context.Job.Method.Name, context.BackgroundJob?.Id); }
public void OnCreated(CreatedContext filterContext) { logger.InfoFormat( "[OnCreated] Job.Method.Name: `{0}` BackgroundJob.Id: `{1}`", filterContext.Job.Method.Name, filterContext.BackgroundJob?.Id); }
public void OnCreated(CreatedContext filterContext) { var mi = filterContext.Job.Method; if (filterContext.Job.Method.DeclaringType != filterContext.Job.Type) { // This job (or method) is from an inherited type, we should use reflection to retrieve the correct Job method var dmi = filterContext.Job.Type.GetMethod(filterContext.Job.Method.Name, filterContext.Job.Method.GetParameters().Select(p => p.ParameterType).ToArray()); mi = dmi ?? mi; } var attrs = mi.GetCustomAttributes <TagAttribute>() .Union(mi.DeclaringType?.GetCustomAttributes <TagAttribute>() ?? Enumerable.Empty <TagAttribute>()) .SelectMany(t => t.Tag).ToList(); if (!attrs.Any()) { return; } if (filterContext.BackgroundJob?.Id == null) { return; } // throw new ArgumentException("Background Job cannot be null", nameof(filterContext)); var args = filterContext.Job.Args.ToArray(); var tags = attrs.Select(tag => string.Format(tag, args)).Where(a => !string.IsNullOrEmpty(a)); filterContext.BackgroundJob.Id.AddTags(tags); }
/// <summary> /// 创建完成 /// </summary> /// <param name="context"></param> public void OnCreated(CreatedContext context) { var jobname = context.Parameters.FirstOrDefault().Value; var arg = string.Join(" , ", context.Job.Args.ToArray()); Logger.WarnFormat(" 创建完成 Job `{0}` , Arg is `{1}`", jobname, arg); }
public void OnCreated(CreatedContext context) { Logger.InfoFormat( "Job that is based on method `{0}` has been created with id `{1}`", context.Job.Method.Name, context.BackgroundJob?.Id); }
public void OnCreated(CreatedContext context) { Console.WriteLine( "Job that is based on method `{0}` has been created with id `{1}`", context.Job.Method.Name, context.BackgroundJob?.Id); }
public void OnCreated(CreatedContext filterContext) { if (!filterContext.Canceled) { // job created, mark it as such filterContext.Connection.SetRangeInHash(GetJobKey(filterContext.Job), new[] { new KeyValuePair <string, string>("jobId", filterContext.BackgroundJob.Id) }); } }
public void OnCreated(CreatedContext filterContext) { WriteLog( $"{ApiConfig.HangfireLogUrl}\\OnCreated-{(filterContext.BackgroundJob?.Id ?? "0")}-{DateTime.Now:yyyy-MM-dd}.txt", $"Job that is based on method `{filterContext.Job.Method.Name}` has been created with id `{filterContext.BackgroundJob?.Id}` . 时间为:{DateTime.Now:yyyy-MM-dd-HH-mm-ss} \r\n"); Logger.InfoFormat( "Job that is based on method `{0}` has been created with id `{1}`", filterContext.Job.Method.Name, filterContext.BackgroundJob?.Id); }
public void Ctor_CorrectlySetsAllProperties() { var connection = new Mock <IStorageConnection>(); var job = Job.FromExpression(() => TestMethod()); var state = new Mock <IState>(); var exception = new Exception(); var stateMachineFactory = new Mock <IStateMachineFactory>(); var createContext = new CreateContext( connection.Object, stateMachineFactory.Object, job, state.Object); var context = new CreatedContext(createContext, true, exception); Assert.True(context.Canceled); Assert.Same(exception, context.Exception); }
public void OnCreated(CreatedContext filterContext) { var mi = filterContext.BackgroundJob.Job.Method; var attrs = mi.GetCustomAttributes <TagAttribute>() .Union(mi.DeclaringType?.GetCustomAttributes <TagAttribute>() ?? Enumerable.Empty <TagAttribute>()) .SelectMany(t => t.Tag).ToList(); if (!attrs.Any()) { return; } var args = filterContext.Job.Args.ToArray(); var tags = attrs.Select(tag => string.Format(tag, args)).Where(a => !string.IsNullOrEmpty(a)); filterContext.BackgroundJob.Id.AddTags(tags); }
public void OnCreated(CreatedContext filterContext) { // BackgroundJob is Nullable from CreatedContext var mi = filterContext?.BackgroundJob?.Job.Method ?? throw new ArgumentException("Background Job cannot be null", nameof(filterContext)); var attrs = mi.GetCustomAttributes <TagAttribute>() .Union(mi.DeclaringType?.GetCustomAttributes <TagAttribute>() ?? Enumerable.Empty <TagAttribute>()) .SelectMany(t => t.Tag).ToList(); if (!attrs.Any()) { return; } var args = filterContext.Job.Args.ToArray(); var tags = attrs.Select(tag => string.Format(tag, args)).Where(a => !string.IsNullOrEmpty(a)); filterContext.BackgroundJob.Id.AddTags(tags); }
public PreserveCultureAttributeFacts() { _connection = new Mock <IStorageConnection>(); var job = Job.FromExpression(() => Sample()); var state = new Mock <IState>(); var stateMachineFactory = new Mock <IStateMachineFactory>(); var createContext = new CreateContext( _connection.Object, stateMachineFactory.Object, job, state.Object); _creatingContext = new CreatingContext(createContext); _createdContext = new CreatedContext(createContext, false, null); var workerContext = new WorkerContextMock(); var performContext = new PerformContext( workerContext.Object, _connection.Object, JobId, job, DateTime.UtcNow, new Mock <IJobCancellationToken>().Object); _performingContext = new PerformingContext(performContext); _performedContext = new PerformedContext(performContext, false, null); }
/// <summary> /// Action: OnCreated /// Description: It is the second filter to update the sync status to 1 for all jobs validated by previous filter. But jobs are not to be started yet. /// Sync status 1 means pending/ongoing. /// </summary> /// <param name="context"></param> void IClientFilter.OnCreated(CreatedContext context) { if (context.Canceled == false || context.Exception == null) { Console.WriteLine(string.Format("Job is based on method `{0}` has been created with id `{1}`", context.Job.Method.Name, context.BackgroundJob?.Id)); var ccid = context.Job.Args.ElementAt(2) as string; int connectorId = (int)context.Job.Args.ElementAt(1); string jobId = context.BackgroundJob?.Id; if (!string.IsNullOrEmpty(ccid) && connectorId > 0) { //set sync status to progress{1}. var connectorLogs = new ConnectorLogs() { sync_started_at = DateTime.UtcNow, sync_ended_at = null, sync_logs = new List <string>() }; SyncRepository.UpdateSyncInfo(id: connectorId, ccid: ccid, status: 1, count: 0, jobid: jobId, connectorLogs: connectorLogs, totaluniquecount: 0, sync_updated_count: 0, deduped_count: 0, total_records_count: 0); } } }
public void OnCreated(CreatedContext filterContext) { //Intentionally Left Blank }
public void OnCreated(CreatedContext context) { string name = context.BackgroundJob.Job.Method.Name; }
public void OnCreated(CreatedContext filterContext) { // Não preciso fazer nada aqui }
public CreatedContext created() { CreatedContext _localctx = new CreatedContext(Context, State); EnterRule(_localctx, 200, RULE_created); int _la; try { EnterOuterAlt(_localctx, 1); { State = 1976; k_created(); State = 1981; ErrorHandler.Sync(this); _la = TokenStream.La(1); while (_la==SCOL) { { { State = 1977; Match(SCOL); State = 1978; other_param(); } } State = 1983; ErrorHandler.Sync(this); _la = TokenStream.La(1); } State = 1984; Match(COL); State = 1985; date_time(); State = 1986; Match(CRLF); } } catch (RecognitionException re) { _localctx.exception = re; ErrorHandler.ReportError(this, re); ErrorHandler.Recover(this, re); } finally { ExitRule(); } return _localctx; }
public void OnCreated(CreatedContext filterContext) { _pusher.NotifyQueueItemsChanged(); }
/// <summary>Evento após o registro de uma ação(client)</summary> /// <param name="context">Contexto do evento</param> public void OnCreated(CreatedContext context) { Logger.LogInformation($"Job that is based on method `{context.Job.Method.Name}` has been created with id `{context.BackgroundJob?.Id}`"); }
public void OnCreated(CreatedContext context) { }
void IClientFilter.OnCreated(CreatedContext filterContext) { }
private static CreatedContext InvokeClientFilter( IClientFilter filter, CreatingContext preContext, Func<CreatedContext> continuation) { filter.OnCreating(preContext); if (preContext.Canceled) { return new CreatedContext( preContext, true, null); } var wasError = false; CreatedContext postContext; try { postContext = continuation(); } catch (Exception ex) { wasError = true; postContext = new CreatedContext( preContext, false, ex); filter.OnCreated(postContext); if (!postContext.ExceptionHandled) { throw; } } if (!wasError) { filter.OnCreated(postContext); } return postContext; }
public void OnCreated(CreatedContext context) { string name = context.BackgroundJob.Job.Method.Name; _logger.LogInformation(name); }
public void OnCreated(CreatedContext filterContext) { }
public void OnCreated(CreatedContext filterContext) { Logger.InfoFormat($"Job that is based on method `{filterContext.Job.Method.Name}` has been created with id `{filterContext.BackgroundJob?.Id}`"); }