/// <summary>
        /// Consumes a single batch from the source stream and updates the subscribed aggregators.
        /// </summary>
        /// <returns>
        /// The updated cursor position after the batch is consumed.
        /// </returns>
        public override async Task <ICursor <TCursor> > RunSingleBatch()
        {
            var resources = distributor as IEnumerable <IStreamQueryPartition <TPartition> >;

            if (resources != null)
            {
                var partitions = new ConcurrentDictionary <IStreamQueryPartition <TPartition>, Unit>(
                    resources.Select(r => new KeyValuePair <IStreamQueryPartition <TPartition>, Unit>(r, Unit.Default)));

                while (partitions.Any())
                {
                    var acquired = await distributor.Distribute(1);

                    Unit _;
                    partitions.TryRemove(acquired.Single(), out _);
                }
            }
            else
            {
                // not all distributors have a finite set of known leasable resources
                await distributor.Distribute(1);
            }

            return(Cursor.New <TCursor>());
        }
Пример #2
0
        public async Task SendEmailTest()
        {
            dynamic myDynamic = new System.Dynamic.ExpandoObject();

            myDynamic.emailTo = "<receiver>";
            myDynamic.comicItem.Safe_Title = "<title>";
            myDynamic.comicItem.Transcript = "<message>";


            await _distributor.Distribute(myDynamic);
        }
Пример #3
0
 void DistributeRequests(object state)
 {
     requestDistributor.Distribute();
 }
Пример #4
0
 public void Run()
 {
     Distributor.Distribute(Distributable);
 }