title: Quartz Job Scheduler - Multi-Tenant Setup
body: <p>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.</p>
  
  <p>I recently worked a lot with the <a href="http://quartz-scheduler.org/" rel="nofollow"><strong>Quartz Job Scheduler</strong></a> 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).</p>
  
  <p>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 <a href="http://www.quartz-scheduler.org/documentation/quartz-2.x/configuration/ConfigJDBCJobStoreClustering" rel="nofollow"><strong>Quartz Clustering</strong></a>).</p>
  
  <p>Our setup looks kinda like this (simplfied): <br/>
  - 1+ production Tomcat (serving application logic) <br/>
  - 1+ production Apache (serving ExtJS front-end and static content) <br/>
  - n databases (one for each customer) <br/></p>
  
  <p>To add something even more tricky: <br/>
  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. </p>
  
  <p>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. </p>
  
  <p>I already thought about combining it with <strong>MariaDB MaxScale</strong> and using <strong>filters</strong> 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.</p>
  
  <p>Is there something that would give me <strong>multi-tenancy with Quartz</strong>? 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?</p>
  
  <p>Any lead, idea or help is very much appreciated!</p>