Sign inSign up

openeuler/quartz

Sponsored OSS

By openeuler

Updated 2 months ago

Image
0

5.1K

openeuler/quartz repository overview

Quick reference

quartz | openEuler

Current quartz docker images are built on the openEuler. This repository is free to use and exempted from per-user rate limits.

Quartz is a richly featured, open source job scheduling library that can be integrated within virtually any Java application - from the smallest stand-alone application to the largest e-commerce system.

Learn more about quartz on quartz documentation⁠.

The tag of each quartz docker image is consist of the version of quartz and the version of basic image. The details are as follows

TagCurrentlyArchitectures
2.5.1-oe2403sp4quartz 2.5.1 on openEuler 24.03-LTS-SP4amd64, arm64
2.5.1-oe2403sp2quartz 2.5.1 on openEuler 24.03-LTS-SP2amd64, arm64
2.5.0-oe2403sp1quartz 2.5.0 on openEuler 24.03-LTS-SP1amd64, arm64

Usage

In this usage, users can select the corresponding {Tag} based on their requirements.

  • Add quartz dependency

    Maven: Add the following dependency to your pom.xml.

    <dependency>
        <groupId>org.quartz-scheduler</groupId>
        <artifactId>quartz</artifactId>
        <version>${quartz.version}</version>
    </dependency>
    
  • Define a Job

    Create a class that implements Job interface:

    package com.example;
    
    import org.quartz.Job;
    import org.quartz.JobDataMap;
    import org.quartz.JobExecutionContext;
    import org.quartz.JobExecutionException;
    
    public class SimpleJob implements Job {
        @Override
        public void execute(JobExecutionContext context) throws JobExecutionException {
            System.out.println("SimpleJob is executed at: " + new java.util.Date());
    
            JobDataMap dataMap = context.getJobDetail().getJobDataMap();
            String jobParam = dataMap.getString("jobParam");
            if(jobParam != null) {
                System.out.println("Job parameter: " + jobParam);
            }
        }
    }
    
  • Schedule the job

    package com.example;
    
    import org.quartz.*;
    import org.quartz.impl.StdSchedulerFactory;
    
    public class QuartzDemo {
        public static void main(String[] args) {
            try {
                Scheduler scheduler = StdSchedulerFactory.getDefaultScheduler();
    
                JobDetail job = JobBuilder.newJob(SimpleJob.class)
                        .withIdentity("job1", "group1")
                        .usingJobData("jobParam", "Hello, Quartz!")
                        .build();
    
                Trigger trigger = TriggerBuilder.newTrigger()
                        .withIdentity("trigger1", "group1")
                        .startNow()
                        .withSchedule(SimpleScheduleBuilder.simpleSchedule()
                                .withIntervalInSeconds(5)
                                .repeatForever())
                        .build();
    
                scheduler.scheduleJob(job, trigger);
    
                scheduler.start();
    
                while (true) {
                    Thread.sleep(1000);
                }
    
            } catch (SchedulerException | InterruptedException e) {
                e.printStackTrace();
            }
        }
    }
    

Question and answering

If you have any questions or want to use some special features, please submit an issue or a pull request on openeuler-docker-images.

Tag summary

Content type

Image

Digest

sha256:a5c788701

Size

473.4 MB

Last updated

2 months ago

docker pull openeuler/quartz

This week's pulls

Pulls:

14

Last week