spring integration + cron + quartz in cluster?

Here’s one way…

Set the auto-startup attribute on the inbound-adapter to false.

Create a custom trigger that only fires once, immediately…

public static class FireOnceTrigger implements Trigger {

    boolean done;

    public Date nextExecutionTime(TriggerContext triggerContext) {
        if (done) {
            return null;
        }
        done = true;
        return new Date();
    }

    public void reset() {
        done = false;
    }
}

In your quartz job, get a reference to the trigger and the SourcePollingChannelAdapter.

When the quartz trigger fires, have the quartz job

  1. adapter.stop()
  2. trigger.reset()
  3. adapter.start()

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)