Exemplo n.º 1
0
        protected virtual void Add2Dispatchers(IQuery <TItem>[] queries)
        {
            IDispatcher <TItem> dispatcher = null;

            for (int i = 0; i < queries.Length; i++)
            {
                if (Is4UniqueKey(queries[i]))
                {
                    dispatcher = Dispatchers.
                                 FirstOrDefault(disp => Is4UniqueKey(disp));

                    if (dispatcher == null)
                    {
                        if (Dispatchers.Length <= _dispatcherInsertionIndex)
                        {
                            Dispatchers =
                                Dispatchers.Resize(Dispatchers.Length + 1);

                            Dispatchers[_dispatcherInsertionIndex] =
                                (dispatcher = Configuration <TItem> .Dispatch.GetDispatcher4UniqueKeyQuery());
                            _dispatcherInsertionIndex++;
                        }
                    }
                }
                else
                {
                    throw new NotImplementedException("Any query other than Unique key is yet to be supported. Sorry.");
                }

                dispatcher.Add(queries[i]);

                Queries.Add(queries[i]);
            }
        }
Exemplo n.º 2
0
 public void ClientSubscribed(IClient client)
 {
     _logger.LogInformation($"Added new subscription to topic: {Name} with id: {client.Id}");
     ThrowIfDisposed();
     _dispatcher.Add(client);
 }