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
- adapter.stop()
- trigger.reset()
- adapter.start()