Announcement Announcement Module
No announcement yet.
scheduling a batch job Page Title Module
Move Remove Collapse
Conversation Detail Module
  • Filter
  • Time
  • Show
Clear All
new posts

  • #16
    The QuartzBatchJob class is basicly a copy-paste of BatchCommandLineLauncher#start method - maybe it is worth to extract this logic from the "command line" class?[/QUOTE]

    could you please post the an example of QuartzBatchJob file. It doesn't come with spring batch examples and what you say about BatchCommandLineLauncher does not apply because it seems that that class was replaced by CommandLineJobRunner. Thanks.


    • #17
      if it is useful for someone, my QuartzBatchJob (on m5) for the example given above is this one and it works fine:

      public class QuartzBatchJob extends QuartzJobBean implements StatefulJob {
      private JobLauncher launcher;
      protected static final Log logger = LogFactory.getLog(QuartzBatchJob.class);
      private JobParametersFactory jobParametersFactory = new DefaultJobParametersFactory();

      protected void executeInternal(JobExecutionContext ctx)
      throws JobExecutionException {

      try {
      ApplicationContext context = new ClassPathXmlApplicationContext(
      context.getAutowireCapableBeanFactory().autowireBe anProperties(
      this, AutowireCapableBeanFactory.AUTOWIRE_BY_TYPE, false);
      String[] parametros={"par1=1","par2=2"};

      Job job = (Job) context.getBean("personaImportJob");
      JobParameters jobParameters = jobParametersFactory
      .splitArrayElementsIntoProperties(parametros, "="));, jobParameters);
      } catch (Throwable e) {
      logger.error("Job Terminated in error:", e);

      // place your Job code here
      /** ********************** */
      System.out.println("EJECUTANDO QUARTZ JOB");

      public void setLauncher(JobLauncher launcher) {
      this.launcher = launcher;



      • #18
        The quartz sample has been ressurected after M5 and there is now QuartzBatchLauncher and eclipse launch configuration provided in the samples.


        • #19
          Where is on m5 samples the eclipse launch configuration you say? I only see the same QuartzBatchLauncher that existed on m4 and nothing else.


          • #20
            It has been added since M5, so it's in the latest trunk but not M5 itself. It should be included in RC1.


            • #21
              BatchCommandLineLauncher in m5

              Originally posted by robert.kasanicky View Post
              One way is to use maven to launch the job - just add the snippet below to your pom.xml and use "mvn exec:exec -Djob.configuration.path=path/to/myJob.xml" as command (or you can hardcode the parameters).

                                        <!-- automatically creates the classpath using all project dependencies, 
                                            also adding the project build directory -->
                                        <classpath />
                                        <!-- job configuration file -->
                                        <!-- job name -->
              BatchCommandLineLauncher is not available in m5 that I can see. How is this done in m5 or am I missing something? Thanks!


              • #22
                I think it's called CommandLineJobRunner.


                • #23
                  CommandLineJobRunner also uses command line arguments instead of VM arguments.