private void ProcessTask(BackgroundTask task) { HandleTask(task, handler => { using (EntryPointContext.SetEntryPoint("BackgroundTask")) { ProcessMonitorWriter.Instance.Write("BackgroundTask"); using (DeferredChannelMessageContext deferredMsgContext = new DeferredChannelMessageContext()) { var contextData = task.Context; using (CustomContext.SetContext(contextData)) { handler.HandleTask(task); } } } }); }
/// <summary> /// Run the provided task in the current thread immediately /// </summary> /// <param name="task">The task to run</param> public void ExecuteImmediately(BackgroundTask task) { ProcessTask(task); }
public void EnqueueTask(BackgroundTask task) { EnqueueTask(RequestContext.TenantId, task); }