Quartz Job Scheduler - 多租户设置 [英] Quartz Job Scheduler - Multi-Tenant Setup

查看:648
本文介绍了Quartz Job Scheduler - 多租户设置的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

由于我没有找到任何可以引导我灵感的东西,我想我会在这里提出这个。

Since I haven't found anything related to that which would have lead me to inspiration, I thought I'd come up with this here.

我最近工作过我已经在RESTful Java中实现的 Quartz Job Scheduler 了很多应该为创建作业提供基于Sencha ExtJS的UI的Servlet。我们将Authenticator类与DatabaseManager结合使用,该类管理器负责验证用户和所有其他特定于数据库的内容(使用Hibernate)。

I recently worked a lot with the Quartz Job Scheduler which I've already implemented within a RESTful Java Servlet that is supposed to offer a Sencha ExtJS-based UI for job creation. We use an Authenticator class in combination with a DatabaseManager that take care of authenticating users and all other database-specific stuff (using Hibernate).

因为我们想在内部使用它我们开发的Java企业应用程序,我们需要为每个客户运行这个东西。我们还需要将JobStoreTX用于MySQL数据库上的持久数据(显然是用于集群),因此易失性RAMJobStore实现是一个禁忌。我知道官方文档,Quartz本身似乎不支持多租户实现(参见 Quartz Clustering 。)

Since we want to use it within the Java enterprise applications we develop, we need to run this thing for every customer. We also require the use of JobStoreTX for persistent data on MySQL databases (obviously for clustering), so volatile RAMJobStore implementation is a taboo. I am aware of the official documentation and that Quartz itself doesn't seem to support multi-tenant implementation (see Quartz Clustering).

我们的设置看起来有点像这样(simplfied):

- 1+生产Tomcat(服务应用程序逻辑)

- 1+生产Apache(服务ExtJS前端和静态内容)

- n数据库(每个客户一个)

Our setup looks kinda like this (simplfied):
- 1+ production Tomcat (serving application logic)
- 1+ production Apache (serving ExtJS front-end and static content)
- n databases (one for each customer)

添加更棘手的东西:

我们有特定于客户的旧模块(每个客户都有自己的应用程序托管),而更多最新的模块集中托管与客户相关的访问。

To add something even more tricky:
we have legacy modules that are customer-specific (each customer gets his own application hosting), while more up-to-date modules are hosted centralized with customer-related access.

在我看来,在每个客户数据库上创建与Quartz相关的表是不够的,因为我们希望坚持简单,直接的设置(这意味着例如每个客户的相同表格前缀等)只是为了不使整个服务器场中的Quartz部署复杂化。

In my opinion, it wouldn't be sufficient to created the Quartz-related tables on every customer database, since we want to stick with an easy, straight forward setup (which means e.g. same table prefix for each customer etc) just to not complicate the deployment of Quartz throughout the farm.

我已经考虑过将它与 MariaDB MaxScale 结合使用,并使用过滤器将Quartz路由到基于的每个客户数据库RegEx或类似的东西,Quartz只与MaxScale代理交谈,但这似乎对我试图实现的东西有点太多开销,我甚至不确定这是否会起作用。

I already thought about combining it with MariaDB MaxScale and using filters to route Quartz to each customer database based on RegEx or something similar, with Quartz only talking to the MaxScale proxy, but this seemed a little bit too much overhead for what I try to achieve and I am not even sure if this would work at all.

有什么东西会给我多租户Quartz 吗?您能否建议一种方法可以使Quartz能够处理这个问题,因为我们需要为每个客户运行作业,但是在一个Tomcat(实际上是集群和负载均衡)上?或者是否有其他产品/框架/库支持开箱即用的多租户?

Is there something that would give me multi-tenancy with Quartz? Could you suggest an approach that would make Quartz being able to handle this, since we need to run jobs for each customer, but on "one" Tomcat (which is actually clustered and loadbalanced)? Or is there another product/framework/library that supports multi-tenancy out of the box?

非常感谢任何领导,想法或帮助!

Any lead, idea or help is very much appreciated!

推荐答案

我终于把它写到多个数据库了。

I finally got it to write to multiple databases.

我所做的是根据各自的客户参数为每个客户即时生成Quartz属性文件,并使程序逻辑读取这个新生成的文件。最后,每个客户都有自己的Quartz作业存储到自己的数据库中。

What I did was generating the Quartz properties file on-the-fly for each customer based on respective customer parameters and made the program logic read this newly generated file. So finally, each customer has its own Quartz jobs stored to its own database.

这篇关于Quartz Job Scheduler - 多租户设置的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆