public Task <string> ReceiveQuery(ReceivedQuery query) { var item = new QueryQueueItem(query); _receivedQueries.Enqueue(item); return(item.ResultSource.Task); }
public IObservable <string> ReceiveQuery(ReceivedQuery query) { var item = new QueryQueueItem(query); _receivedQueries.Enqueue(item); return(item.ResultSubject); }
private void ProcessQuery(QueryQueueItem item) { if (_queryHandlers.TryGetValue(item.Query.Command, out var handler)) { handler?.Invoke(item.Query); } item.ResultSource.SetResult(item.Query.Result); }
private void ProcessQuery(QueryQueueItem item) { QueryRequested?.Invoke(item.Query); item.ResultSubject.OnNext(item.Query.Result); item.ResultSubject.OnCompleted(); }