예제 #1
0
 /// <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);
         }
     }
 }
예제 #2
0
 public Publisher(QueueConfig _queueConfig)
 {
     queue = QueueFactory.CreateClient(_queueConfig, false);
 }
예제 #3
0
 public Publisher(Microsoft.Extensions.Options.IOptions <QueueConfig> options)
 {
     queue = QueueFactory.CreateClient(options.Value, false);
 }
예제 #4
0
 public void StopSubscribe()
 {
     QueueFactory.DisposeAll();
 }