예제 #1
0
        public Task <string> ReceiveQuery(ReceivedQuery query)
        {
            var item = new QueryQueueItem(query);

            _receivedQueries.Enqueue(item);
            return(item.ResultSource.Task);
        }
예제 #2
0
        public IObservable <string> ReceiveQuery(ReceivedQuery query)
        {
            var item = new QueryQueueItem(query);

            _receivedQueries.Enqueue(item);
            return(item.ResultSubject);
        }
예제 #3
0
 private void ProcessQuery(QueryQueueItem item)
 {
     if (_queryHandlers.TryGetValue(item.Query.Command, out var handler))
     {
         handler?.Invoke(item.Query);
     }
     item.ResultSource.SetResult(item.Query.Result);
 }
예제 #4
0
 private void ProcessQuery(QueryQueueItem item)
 {
     QueryRequested?.Invoke(item.Query);
     item.ResultSubject.OnNext(item.Query.Result);
     item.ResultSubject.OnCompleted();
 }