Search code examples
quartz-schedulerspring-integration

SimpleTriggerFactoryBean in spring integration with javaconfig


I need a quartz job in cluster to initialize spring integration flow on one node only. Please help how to setup spring integration poller with SimpleTriggerFactoryBean. I prefer javaconfig solution.

And how to integrate this:

@PersistJobDataAfterExecution
@DisallowConcurrentExecution
public class HarvestStateJob extends QuartzJobBean {

Right now I just call spring integration gateway in quartz job directly to run integration flow.

@Override
    protected void executeInternal(JobExecutionContext context) throws JobExecutionException {

But I do not like this solution. Is there way to run integration flow directly?


Solution

  • Unfortunately no, there is no other way.

    Spring Integration doesn't support integration with quertz (yet): https://jira.spring.io/browse/INT-2731

    Feel free to comment there to track more info and ideas.

    Right now your solution sounds good. You have a gateway to the Spring Integration Universe and hide everything from Quearz Job. And just initiate some invocation from there as usual.

    Even if it wouldn't be Spring Integration, you need something to invoke from Quartz Jobs. So, everything sound good for you.

    And that's may be the reason why we don't have a Quartz Poller out-of-the-box :-).