public void Start() { TaskQuque queue = new TaskQuque(); producer = new TaskProducer(queue); consumer = new TaskConsumer(queue); host = new ServiceHost(new MissionService(queue)); producer.Start(); consumer.Start(); host.Open(); }
/// <summary> /// 任务消费者 /// </summary> /// <param name="taskQueue">需要从其中取出task执行</param> /// <param name="workFrequency">消费频率,毫秒为单位</param> public TaskConsumer(TaskQuque taskQueue, int workFrequency) { this.queue = taskQueue; this.workFrequency = workFrequency; }
/// <summary> /// 任务消费者 /// </summary> /// <param name="taskQueue">需要从其中取出task执行</param> public TaskConsumer(TaskQuque taskQueue) : this(taskQueue, DefaultWorkFrequency) { }
public TaskProducer(TaskQuque queue, int workFrequency) { this.queue = queue; this.workFrequency = workFrequency; }
public TaskProducer(TaskQuque queue) : this(queue, DefaultWorkFrequency) { }