spring integration + cron + quartz in cluster?

前端 未结 4 527
猫巷女王i
猫巷女王i 2020-12-01 15:23

I have a spring integration flow triggered by the cron expression like follows:


    <         


        
4条回答
  •  轻奢々
    轻奢々 (楼主)
    2020-12-01 15:46

    the solution from Gary works. This my spring context:

    
        
    
    
    
    
    
    
    
        
            
                
            
        
    
        
            
                
                
            
        
    
    
    
        
        
    
    
    
        
    
    

    and MyActivatorJob class:

    public class MyActivatorJob extends QuartzJobBean implements {
    
    private AbstractEndpoint inputEndpoint;
    
    private FireOnceTrigger inputEndpointTrigger;
    
    public void setInputEndpoint(final AbstractEndpoint pInputEndpoint) {
        this.inputEndpoint = pInputEndpoint;
    }
    
    public void setInputEndpointTrigger(final FireOnceTrigger pInputEndpointTrigger) {
        this.inputEndpointTrigger = pInputEndpointTrigger;
    }
    
    @Override
    protected void executeInternal(final JobExecutionContext pParamJobExecutionContext)
    throws JobExecutionException {
    
        inputEndpoint.stop();
        inputEndpointTrigger.reset();
        inputEndpoint.start();
    }
    

    }

    As a next step this spring context would have to be refactored to replace the usage of schedulerContextAsMap with something more flexible and be able to define more jobs activating and deactivating many different endpoints.

    Thanks Gary so far!

提交回复
热议问题