https://github.com/rocketbase-io/db-scheduler-log
extension for db-scheduler that registers as log-service
https://github.com/rocketbase-io/db-scheduler-log
Last synced: 8 months ago
JSON representation
extension for db-scheduler that registers as log-service
- Host: GitHub
- URL: https://github.com/rocketbase-io/db-scheduler-log
- Owner: rocketbase-io
- License: apache-2.0
- Created: 2023-02-24T20:27:32.000Z (over 3 years ago)
- Default Branch: main
- Last Pushed: 2024-03-22T15:29:34.000Z (about 2 years ago)
- Last Synced: 2025-09-30T22:41:50.243Z (8 months ago)
- Language: Java
- Size: 77.1 KB
- Stars: 20
- Watchers: 0
- Forks: 4
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
- awesome - rocketbase-io/db-scheduler-log - extension for db-scheduler that registers as log-service (<a name="Java"></a>Java)
README
# db-scheduler-log

[](https://maven-badges.herokuapp.com/maven-central/io.rocketbase.extension/db-scheduler-log)
[](http://www.apache.org/licenses/LICENSE-2.0.html)
## Getting started
1. Add maven dependency
```xml
io.rocketbase.extension
db-scheduler-log
${version}
```
2. Create the `scheduled_execution_logs` table in your database-schema. See table definition
for [postgresql](db-scheduler-log/src/test/resources/postgresql_tables.sql), [oracle](db-scheduler-log/src/test/resources/oracle_tables.sql), [mssql](db-scheduler-log/src/test/resources/mssql_tables.sql)
or [mysql](db-scheduler-log/src/test/resources/mysql_tables.sql).
> :mega: It's highly recommended to create the log-table with daily partitions based on time_started with a proper
> retention when you have a huge amount of running tasks... otherwise you could run out of disk-space quite soon.
3. Customize the scheduler to use extended StatsRegistry.
```java
final JdbcLogRepository jdbcLogRepository=new JdbcLogRepository(dataSource,new JavaSerializer(),JdbcLogRepository.DEFAULT_TABLE_NAME,new Snowflake());
final Scheduler scheduler=Scheduler
.create(dataSource)
.startTasks(hourlyTask)
.threads(5)
.statsRegistry(new LogStatsPlainRegistry(jdbcLogRepository))
.build();
```
## Spring Boot usage
For Spring Boot applications, there is a starter `db-scheduler-log-spring-boot-starter` making the scheduler-log-wiring
very simple.
### Prerequisites
- An existing Spring Boot application
- A working `DataSource` with schema initialized. (In the example HSQLDB is used and schema is automatically applied.)
### Getting started
1. Add the following Maven dependency
```xml
io.rocketbase.extension
db-scheduler-log-spring-boot-starter
${version}
```
**NOTE**: This includes the db-scheduler-spring-boot-starter dependency itself.
2. Do configuration explained on db-scheduler...
3Run the app.
### Configuration options
Configuration is mainly done via `application.properties`. Configuration of table-name is done by properties.
```
# application.properties example showing default values
db-scheduler-log.enabled=true
db-scheduler-log.table-name=scheduled_execution_logs
```