Package org.quartzplus.service
Class DataSourceJobExecutionLogServiceImpl
java.lang.Object
org.quartzplus.service.DataSourceJobExecutionLogServiceImpl
- All Implemented Interfaces:
JobExecutionLogService
Database-backed implementation of the
JobExecutionLogService using Spring's JdbcTemplate.
This service handles the persistence and retrieval of job execution history and scheduler node status using a relational database. It supports dynamic table prefixes to integrate with existing Quartz schema naming conventions.
- See Also:
-
Constructor Summary
ConstructorsConstructorDescriptionDataSourceJobExecutionLogServiceImpl(org.springframework.jdbc.core.JdbcTemplate jdbcTemplate, String tablePrefix) Constructs a new service instance with a specified template and table prefix. -
Method Summary
Modifier and TypeMethodDescriptionintclearJobExecutionLog(Instant until) Deletes log entries created before the specified timestamp.getJobExecutionLog(String jobExecutionLogId) Fetches a specific job execution log by its unique identifier.org.springframework.data.domain.Page<JobExecutionLog> getJobExecutionLogList(Integer pageSize, Integer currentPage, String groupName, String jobName, String triggerName, String instanceClass) Retrieves a paged list of job execution logs filtered by optional criteria.Retrieves the status of all registered Quartz scheduler nodes in the cluster.Returns the database table prefix used by this service.voidinsertJobExecutionLog(JobExecutionLog jobExecutionLog) Persists a new job execution log entry into the database.
-
Constructor Details
-
DataSourceJobExecutionLogServiceImpl
public DataSourceJobExecutionLogServiceImpl(org.springframework.jdbc.core.JdbcTemplate jdbcTemplate, String tablePrefix) Constructs a new service instance with a specified template and table prefix.- Parameters:
jdbcTemplate- the JDBC template used for database operations.tablePrefix- the prefix for Quartz and QuartzPlus tables (e.g., "QRTZ_").
-
-
Method Details
-
getJobExecutionLogList
public org.springframework.data.domain.Page<JobExecutionLog> getJobExecutionLogList(Integer pageSize, Integer currentPage, @Nullable String groupName, @Nullable String jobName, @Nullable String triggerName, @Nullable String instanceClass) Retrieves a paged list of job execution logs filtered by optional criteria.Results are returned in descending order of creation time.
- Specified by:
getJobExecutionLogListin interfaceJobExecutionLogService- Parameters:
pageSize- number of records per page.currentPage- the zero-based page index.groupName- (Optional) filter by job group name.jobName- (Optional) filter by job name.triggerName- (Optional) filter by trigger name.instanceClass- (Optional) filter by the job's implementation class name.- Returns:
- a
Pagecontaining the requested logs and total count.
-
getJobExecutionLog
Fetches a specific job execution log by its unique identifier.- Specified by:
getJobExecutionLogin interfaceJobExecutionLogService- Parameters:
jobExecutionLogId- the UUID or unique ID of the log entry.- Returns:
- an
Optionalcontaining the log if found, or empty otherwise.
-
insertJobExecutionLog
Persists a new job execution log entry into the database.- Specified by:
insertJobExecutionLogin interfaceJobExecutionLogService- Parameters:
jobExecutionLog- the log data to insert.
-
clearJobExecutionLog
Deletes log entries created before the specified timestamp.- Specified by:
clearJobExecutionLogin interfaceJobExecutionLogService- Parameters:
until- the cutoff timestamp for deletion.- Returns:
- the number of records deleted.
-
getQuartzExecutionNodeList
Retrieves the status of all registered Quartz scheduler nodes in the cluster. Reads from theSCHEDULER_STATEtable.- Specified by:
getQuartzExecutionNodeListin interfaceJobExecutionLogService- Returns:
- a list of
QuartzExecutionNodeobjects.
-
getTablePrefix
Returns the database table prefix used by this service.- Specified by:
getTablePrefixin interfaceJobExecutionLogService- Returns:
- the table prefix string.
-