Beispiel #1
0
 //这里使用了Rx的一个技巧,让一个消费者订阅Channel,然后把这个消费者作为新的广播者,就可以被多个消费订阅了。
 public AsyncMessageBroker()
 {
     channel         = Channel.CreateSingleConsumerUnbounded <T>();
     multicastSource = channel.Reader.ReadAllAsync().Publish();
     connection      = multicastSource.Connect(); // Publish returns IConnectableUniTaskAsyncEnumerable.
 }
Beispiel #2
0
 public AsyncMessageBroker()
 {
     channel         = Channel.CreateSingleConsumerUnbounded <T>();
     multicastSource = channel.Reader.ReadAllAsync().Publish();
     connection      = multicastSource.Connect();
 }
 public void Do()
 {
     // Connect() を実行したタイミングで稼働開始
     _disposable = _connectableUniTaskAsyncEnumerable?.Connect();
 }