private JobAndWorkerType JobAndWorkerTypeOfCode(string jobTypeCode) { var jobType = JobTypeOfCode(jobTypeCode); var workerType = WorkerTypeOfCode(jobTypeCode); var jobAndWorkerType = new JobAndWorkerType { JobType = jobType, WorkerType = workerType }; return jobAndWorkerType; }
public void ReadFrom(XmlElement jobConfigurationElement) { //RequestMaxAttempts if (jobConfigurationElement.HasAttribute("RequestMaxAttempts")) { Debug.Assert(jobConfigurationElement != null, "jobConfigurationElement != null"); var requestMaxAttemptsElement = jobConfigurationElement.GetAttribute("RequestMaxAttempts"); RequestMaxAttempts = Int32.Parse(requestMaxAttemptsElement); } //RequestTimeout if (jobConfigurationElement.HasAttribute("RequestTimeout")) { var requestTimeoutElement = jobConfigurationElement.GetAttribute("RequestTimeout"); RequestTimeout = TimeSpan.FromMilliseconds(Int32.Parse(requestTimeoutElement)); } //JobAndWorkerType var jobAndWorkerTypeElement = (XmlElement)jobConfigurationElement.GetElementsByTagName("JobAndWorkerType")[0]; JobAndWorkerType = new JobAndWorkerType(); JobAndWorkerType.ReadFrom(jobAndWorkerTypeElement); }
public JobConfiguration() { JobAndWorkerType = new JobAndWorkerType(); RequestMaxAttempts = 1; RequestTimeout = TimeSpan.FromMinutes(1); }
public void ConfigureDispatcherToHandleJob(string dispatcherId, JobAndWorkerType jobAndWorkerType, DispatcherLifeSpan dispatcherLifeSpan) { var dispatcherSettings = DispatcherSettings.Single(c => c.DispatcherId.Value == dispatcherId); dispatcherSettings.DispatcherLifeSpan = dispatcherLifeSpan; if (dispatcherSettings.JobConfigurations.Any( c => c.JobAndWorkerType.JobType == jobAndWorkerType.JobType)) return; var jobConfiguration = new JobConfiguration { JobAndWorkerType = { JobType = jobAndWorkerType.JobType, WorkerType = jobAndWorkerType.WorkerType } }; dispatcherSettings.JobConfigurations.Add(jobConfiguration); }