/// <summary> /// 构建MessageQueue /// </summary> /// <param name="settings">消息队列设置</param> /// <param name="logger">日志对象</param> public MessageQueue(AsyncQueueSetting settings, ILogger logger) { var queue = new ConcurrentQueue <MessageWrapper <TMessage> >(); this._consumingMessageQueue = new BlockingCollection <MessageWrapper <TMessage> >(queue, settings.MaxConsumeringMessageCount); this._handlingMessageDict = new ConcurrentDictionary <MessageId, MessageWrapper <TMessage> >(); this._settings = settings; this._scheduleService = new Interval(logger); this._workerManager = new WorkerManager(logger, this._settings.WorkThreadCount); this._logger = logger; }
public PullMessageQueue(AsyncQueueSetting settings, ILogger logger, IEqualityComparer <TMessage> messageEqualityComparer) : base(settings, logger) { this._settings = settings; this._logger = logger; this._messageEqualityComparer = messageEqualityComparer; this._keySelector = DefaultKeySelector; this._pullMessageInterval = TimeSpan.Zero; this._pullMessageService = new Interval(logger); }
/// <summary> /// 构造一个异步队列 /// </summary> /// <param name="settings">配置信息</param> public PushAsyncQueue(AsyncQueueSetting settings) : this(settings, null) { }
/// <summary> /// 构造一个异步队列 /// </summary> /// <param name="settings">配置信息</param> /// <param name="logger"></param> public PushAsyncQueue(AsyncQueueSetting settings, ILogger logger) { this._setting = settings; this._logger = logger ?? new NullLogger(); this._messageQueue = new MessageQueue <TMessage>(this._setting, this._logger); }
internal AsyncQueue(AsyncQueueSetting settings, ILogger logger) { this._setting = settings; this._logger = logger; }