Quartz .Net architecture question
Here is the scenario. I have an application that can be in constant connection with a server for multiple reasons. There are three general sets of objects that I need to get from or post to a webserver.
Business Data Objects. This is essentially data that gets pulled down from the server to client machines and stored in a local DB. IF a user updates the data on their local machine, it gets flagged and needs to be sent up to be synched with the server. There are approx 6 custom classes that will need to pull down data and send data to the server (when needed).
Files. Just as it states, this synch is for files. Files can be uploaded to the ser开发者_StackOverflowver. But more importantly, files can be downloaded to the client. There will be files that are automatically sent from server and other files that will be on demand.
Connection / Login queries. These synchs will pull user information from the server and regularly check for updated info and verify permissions. There also needs to be a check to make sure that the application is connected to the server, and if connection is lost, then handle that appropriately.
I am very new to Quartz and am trying to think of the best way to setup these 3 distinct synchronizations that I want to happen. I have a few questions.
If I wanted multiple thread pools, would I just want to create 3 separate scheduler factories? How would I accomplish this with a config, or would I need to have it coded to explicitly set Quartz properties prior to each instantiation of the factory?
The business data objects synchronization will be the heaviest load at times. When a user first logs in, or is assigned additional permissions, they can be required to download up to 10K objects/records from the server. This would be an infrequent occurrence, and ideally the user would connect, the data would all download, and 5-10 minutes later they can use the application for their purposes. This synch would need to constantly check the server to see if their is new data and monitor local data to see if new data needs to be sent to server. Would it make sense to have a factory handle all of this with it's own thread pool of say, 10 threads?
Ultimately, I am just trying to figure out how to initially plan out this entire process and split things apart to easily manage them and do it correctly. This is for a proof of concept and any help would be great appreciated. Please feel free to critique any of the above.
Thanks!
You can plug a custom thread pool by implementing Quartz.Spi.IThreadPool
. A scheduler only has a single IThreadPool
, but you may be able to mask multiple thread pools behind that single interface, although the implementation would need information about the jobs being scheduled in order to derive them to each thread.
The default implementation, Quartz.Simpl.SimpleThreadPool
, has a fixed (configurable) number of threads, all with the same (configurable) priority.
Otherwise, you could have multiple schedulers as you said. This is easier, you'd just have multiple independent scheduler factories, but they should not share any state.
精彩评论