title: How to use different host with quartz depending on trigger?
body: <p>I need to programmatically choose which scheduler to use for a certain job based on trigger. 
  I don't know where I have to tackle. </p>
  
  <p>This is the quartz app config section:</p>
  
  <pre><code> &lt;quartz&gt;
      &lt;add key="quartz.scheduler.instanceName" value="ServerScheduler" /&gt;
  
      &lt;add key="quartz.threadPool.type" value="Quartz.Simpl.SimpleThreadPool, Quartz" /&gt;
      &lt;add key="quartz.threadPool.threadCount" value="10" /&gt;
      &lt;add key="quartz.threadPool.threadPriority" value="Normal" /&gt;
  
      &lt;add key="quartz.scheduler.exporter.type" value="Quartz.Simpl.RemotingSchedulerExporter, Quartz" /&gt;
      &lt;add key="quartz.scheduler.exporter.port" value="555" /&gt;
      &lt;add key="quartz.scheduler.exporter.bindName" value="QuartzScheduler" /&gt;
      &lt;add key="quartz.scheduler.exporter.channelType" value="tcp" /&gt;
  
      &lt;add key="quartz.jobStore.misfireThreshold" value="40000" /&gt;
      &lt;add key="quartz.jobStore.type" value="Quartz.Impl.AdoJobStore.JobStoreTX, Quartz" /&gt;
      &lt;add key="quartz.jobStore.dataSource" value="default" /&gt;
      &lt;add key="quartz.jobStore.tablePrefix" value="QRTZ_" /&gt;
      &lt;add key="quartz.jobStore.clustered" value="true" /&gt;
      &lt;add key="quartz.jobStore.maxMisfiresToHandleAtATime" value="40" /&gt;
      &lt;add key="quartz.jobStore.lockHandler.type" value="Quartz.Impl.AdoJobStore.UpdateLockRowSemaphore, Quartz" /&gt;
      &lt;add key="quartz.dataSource.default.connectionString" value="Integrated Security=SSPI;Pooling=false;Data Source=(local)\SQLEXPRESS;Initial Catalog=XXX" /&gt;
      &lt;add key="quartz.dataSource.default.provider" value="SqlServer-20" /&gt;
    &lt;/quartz&gt;
  </code></pre>
  
  <p>Then our service looks like this:</p>
  
  <pre><code>public void ScheduleJob(ITrigger trigger)
          {
              IScheduler scheduler = WMSScheduler.GetScheduler();
  
              try
              {
                  scheduler.ScheduleJob(trigger);
              }
              catch (SocketException)
              {
                  throw new Exception(CaptionHelper.GetLocalizedText(@"Messages\Common", "QuartzNotRunning"));
              }
          }
  
  
  public static IScheduler GetScheduler()
          {
              if (scheduler == null)
              {
                  scheduler = BuildScheduler();
              }
  
              return scheduler;
          }
  
    public static bool IsSchedulerStarted()
          {
              string proxyAddress = GetProxyAddress();
  
              Uri uri;
              if (Uri.TryCreate(proxyAddress, UriKind.RelativeOrAbsolute, out uri))
              {
                  return IsPortListening(uri);
              }
  
              throw new InvalidOperationException("The configured Scheduler address is incorrect.");
          }
  </code></pre>
  
  <p>This functionality wasn't developed by me so I am still learning and trying to understand how this works. </p>
  
  <p>As I understood at this moment there are 2 Quartz hosts at 2 servers and we can not indicate what is done by which Quartz host but sometimes we want to steer on which server is done what.</p>
  
  <p>Any idea? </p>