예제 #1
0
        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();
        }
예제 #2
0
 /// <summary>
 /// 任务消费者
 /// </summary>
 /// <param name="taskQueue">需要从其中取出task执行</param>
 /// <param name="workFrequency">消费频率,毫秒为单位</param>
 public TaskConsumer(TaskQuque taskQueue, int workFrequency)
 {
     this.queue         = taskQueue;
     this.workFrequency = workFrequency;
 }
예제 #3
0
 /// <summary>
 /// 任务消费者
 /// </summary>
 /// <param name="taskQueue">需要从其中取出task执行</param>
 public TaskConsumer(TaskQuque taskQueue)
     : this(taskQueue, DefaultWorkFrequency)
 {
 }
예제 #4
0
 public TaskProducer(TaskQuque queue, int workFrequency)
 {
     this.queue         = queue;
     this.workFrequency = workFrequency;
 }
예제 #5
0
 public TaskProducer(TaskQuque queue)
     : this(queue, DefaultWorkFrequency)
 {
 }