Scheduler is an asynchronous producer-consumer model that allows producers concurrently add items to the collection and consumes each item from the collection in single thread.
The flow can be summarized with following steps:
The Scheduler performs following behaviors to handle main loop thread:
This project defines a set of Redis wrapper that can be used to replace in-memory collection. In this scenario, items are stored in Redis list instead of local memory and wrapped by RedisQueue or RedisStack. This can avoid large local memory use when a number of items are not consumed yet.
By applying ObservableRedisQueue or ObservableRedisStack, which implements INotifyCollectionChanged interface, it is also possible that multiple application instances share same collection. Once new items have been added via an application instance, all instances sharing same Redis collection will receive the notification and start the main loop thread respectively.
The Redis wrappers are defined in ModelWorkshop.Scheduling.Redis namespace.
This project targets .Net Core and .Net Framework 4.5.