/// <summary> /// 启动订阅 /// </summary> /// <param name="serviceInstanceCtor">core 传入服务实例化委托</param> public void StartSubscribe(Func <Type, object> serviceInstanceCtor = null) { //var queueConfig = QueueConfig.GetConfig(); foreach (var ed in eventRegister.Values) { var queue = QueueFactory.GetQueueClient(queueConfig, ed); ed.IQueue = queue; ed.ServiceInstanceCtor = serviceInstanceCtor;//core 传入服务实例化委托 if (ed.IsCopy) { ed.StartPublishThread(); } if (ed.IsAsync) { queue.SubscribeAsync(ed); } else { queue.Subscribe(ed); } } }
public Publisher(QueueConfig _queueConfig) { queue = QueueFactory.CreateClient(_queueConfig, false); }
public Publisher(Microsoft.Extensions.Options.IOptions <QueueConfig> options) { queue = QueueFactory.CreateClient(options.Value, false); }
public void StopSubscribe() { QueueFactory.DisposeAll(); }