/// <summary> /// If a continuous job is set as singleton it'll run only on a single /// instance opposed to running on all instances. /// </summary> /// <param name='operations'> /// Reference to the /// Microsoft.WindowsAzure.WebSitesExtensions.IWebJobOperations. /// </param> /// <param name='jobName'> /// The job name. /// </param> /// <param name='isSingleton'> /// Boolean value indicating if the job is singleton or not. /// </param> /// <returns> /// A standard service response including an HTTP status code and /// request ID. /// </returns> public static OperationResponse SetSingleton(this IWebJobOperations operations, string jobName, bool isSingleton) { try { return(operations.SetSingletonAsync(jobName, isSingleton).Result); } catch (AggregateException ex) { if (ex.InnerExceptions.Count > 1) { throw; } else { throw ex.InnerException; } } }
/// <summary> /// If a continuous job is set as singleton it'll run only on a single /// instance opposed to running on all instances. /// </summary> /// <param name='operations'> /// Reference to the /// Microsoft.WindowsAzure.WebSitesExtensions.IWebJobOperations. /// </param> /// <param name='jobName'> /// The job name. /// </param> /// <param name='isSingleton'> /// Boolean value indicating if the job is singleton or not. /// </param> /// <returns> /// A standard service response including an HTTP status code and /// request ID. /// </returns> public static Task <OperationResponse> SetSingletonAsync(this IWebJobOperations operations, string jobName, bool isSingleton) { return(operations.SetSingletonAsync(jobName, isSingleton, CancellationToken.None)); }