Exemple #1
0
        private void Queue()
        {
            var addresses = DataFactory.ZipCodes();

            var scheduler = WebRequestScheduler.Instance;

            scheduler.Start();

            Log.Information($"Begin processing of NPI requests. Total ZipCodes found [{addresses.Count()}]");
            //For testing purpose only when you want to process only one batch
            //Else comment this out for production.
            //addresses = addresses.Take(1);

            foreach (var address in addresses)
            {
                var n = DataFactory.Processed(address);
                if (n == -1)//-1 means proocessing of zip code complete
                {
                    Log.Debug($"{address.ToString()} already processed. Skipping now");
                    continue;
                }

                //First time when we are queuing a pincode for processing
                //pass skip = 0, The API will treat 0 as nothing to skip,
                //Further in the processing pipeline, we will pass 1,2....
                //to skip entry level result and spool more results beyond
                //the max limit for an API request.
                var request = NPIRequest.Create(address, n);
                Log.Debug($"{address.ToString()}, iteration {n} processing started.");
                scheduler.Submit(request);
            }
        }
Exemple #2
0
 public static NPIRequest Next(NPIRequest source)
 {
     return(NPIRequest.Create(source.Address, source.Skip + 1));
 }