简体   繁体   English

Quartz .Net体系结构问题

[英]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. 我需要从Web服务器获取或发布到Web服务器的三组常规对象。

  1. 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). 大约有6个自定义类,它们将需要提取数据并将数据发送到服务器(需要时)。

  2. Files. 文件。 Just as it states, this synch is for files. 就像它指出的那样,这种同步是针对文件的。 Files can be uploaded to the server. 文件可以上传到服务器。 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. 将有从服务器自动发送的文件和其他需要的文件。

  3. 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. 我对Quartz并不陌生,正在尝试思考设置这三种我想发生的同步的最佳方法。 I have a few questions. 我有几个问题。

  1. If I wanted multiple thread pools, would I just want to create 3 separate scheduler factories? 如果我想要多个线程池,我是否只想创建3个单独的调度程序工厂? 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? 我将如何使用配置来完成此操作,或者需要在工厂的每次实例化之前对其进行编码以显式设置Quartz属性?

  2. 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. 当用户首次登录或被分配其他权限时,可能要求他们从服务器下载多达1万个对象/记录。 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. 这种情况很少发生,理想情况下,用户可以连接,数据全部下载,并且5-10分钟后,他们可以将应用程序用于其目的。 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? 让工厂使用自己的线程池(例如10个线程)来处理所有这些问题是否有意义?

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 . 您可以通过实现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. 调度程序只有一个IThreadPool ,但是您可以屏蔽该单个接口后面的多个线程池,尽管实现需要有关被调度的作业的信息才能将它们派生到每个线程。

The default implementation, Quartz.Simpl.SimpleThreadPool , has a fixed (configurable) number of threads, all with the same (configurable) priority. 默认实现Quartz.Simpl.SimpleThreadPool具有固定(可配置)数量的线程,所有线程都具有相同(可配置)优先级。

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. 这比较容易,您只有多个独立的调度程序工厂,但它们不应共享任何状态。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM