天津投入产出系统后端
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

47 lines
1.0 KiB

using System;
using System.Threading.Tasks;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using QM.Exchange.Interface;
namespace QM.Exchange.Core.Services
{
/// <summary>
/// 服务管理
/// </summary>
public class ServiceManager
{
//服务器时间同步示例服务
private IService _stService = new ServerTimeService();
//任务队列服务
private IService _taskService = new MessageQueueService();
private void TaskStart(Action action)
{
Task.Factory.StartNew(action);
}
/// <summary>
/// 启动
/// </summary>
public void Start()
{
//启动服务器时间同步示例服务
TaskStart(_stService.Start);
//启动消息事件服务
TaskStart(_taskService.Start);
}
/// <summary>
/// 停止
/// </summary>
public void Stop()
{
_stService.Stop();
_taskService.Stop();
}
}
}