All Projects → quarkiverse → quarkus-jberet

quarkiverse / quarkus-jberet

Licence: Apache-2.0 license
Quarkus Extension for Batch Applications.

Programming Languages

java
68154 projects - #9 most used programming language
groovy
2714 projects

Projects that are alternatives of or similar to quarkus-jberet

aws-batch-example
Example use of AWS batch
Stars: ✭ 96 (+269.23%)
Mutual labels:  batch
OGMNeo
[No Maintenance] Neo4j nodeJS OGM(object-graph mapping) abstraction layer
Stars: ✭ 54 (+107.69%)
Mutual labels:  batch
terraform-scheduled-batch-job
A Terraform module representing a scheduled Batch job
Stars: ✭ 22 (-15.38%)
Mutual labels:  batch
CWP-Utilities
Combined Windows Privacy Utilities | Hosts file updater, block list manager, and more. Open source tools for Windows users, to help ensure privacy & security. Block ads, spyware domains, and other malicious activity/traffic, all through a simple interface.
Stars: ✭ 63 (+142.31%)
Mutual labels:  batch
WPWatcher
Wordpress Watcher is a wrapper for WPScan that manages scans on multiple sites and reports by email and/or syslog. Schedule scans and get notified when vulnerabilities, outdated plugins and other risks are found.
Stars: ✭ 34 (+30.77%)
Mutual labels:  batch
ocr2text
Convert a PDF via OCR to a TXT file in UTF-8 encoding
Stars: ✭ 90 (+246.15%)
Mutual labels:  batch
camunda-bpm-custom-batch
using the camunda batch execution for custom batch runs
Stars: ✭ 22 (-15.38%)
Mutual labels:  batch
ee.Screen
Takes screenshots of web pages for the list of URLs. Various resolutions, multiple formats (JPG, PDF, PNG and TXT)
Stars: ✭ 19 (-26.92%)
Mutual labels:  batch
ProcessAdminActions
ProcessWire control panel for running various admin actions
Stars: ✭ 17 (-34.62%)
Mutual labels:  batch
aly
Command Line Alias Manager and Plugin System - Written in Golang
Stars: ✭ 21 (-19.23%)
Mutual labels:  batch
python-batch-runner
A tiny framework for building batch applications as a collection of tasks in a workflow.
Stars: ✭ 22 (-15.38%)
Mutual labels:  batch
rack-cargo
🚚 Batch requests for Rack apps (works with Rails, Sinatra, etc)
Stars: ✭ 17 (-34.62%)
Mutual labels:  batch
mongoose-plugin-cache
The Perfect Marriage of MongoDB and Redis
Stars: ✭ 42 (+61.54%)
Mutual labels:  batch
EspBuddy
Wrapper to easily upload (OTA or Serial), backup, batch query, monitor ESP8266 boards using Esptool.py, Espota.py and Platformio
Stars: ✭ 47 (+80.77%)
Mutual labels:  batch
easy qsub
Easily submitting multiple PBS jobs or running local jobs in parallel. Multiple input files supported.
Stars: ✭ 26 (+0%)
Mutual labels:  batch
ServiceCommander-IBMi
Service Commander for IBM i
Stars: ✭ 29 (+11.54%)
Mutual labels:  batch
xToBatConverter
Generate a ms batch file and inject a files inside of it. When the batch is executed, the files are extracted and executed.
Stars: ✭ 17 (-34.62%)
Mutual labels:  batch
Batch-Antivirus
Batch Antivirus, a powerful antivirus suite written in batch with real-time protection and heuristical scanning.
Stars: ✭ 26 (+0%)
Mutual labels:  batch
sync-engine-example
Synchronization Algorithm Exploration: Techniques to synchronize a SQL database with external destinations.
Stars: ✭ 17 (-34.62%)
Mutual labels:  batch
Windows-10-tweaks
This repo contains multiple scripts to optimize windows 10
Stars: ✭ 37 (+42.31%)
Mutual labels:  batch

Quarkus JBeret Extension

Build License Central All Contributors

The Quarkus JBeret Extension adds support for JSR-352 Batch Applications for the Java Platform. JBeret is an implementation of the JSR-352.

Usage

To use the extension, add the dependency to the target project:

<dependency>
  <groupId>io.quarkiverse.jberet</groupId>
  <artifactId>quarkus-jberet</artifactId>
  <version>1.1.0</version>
</dependency>

ℹ️ Recommended Quarkus version: 2.6.2.Final or higher

⚠️ JBeret requires running with --add-opens=java.base/java.security=ALL-UNNAMED for JDK 17

The Batch API and Runtime will be available out of the box. Please refer to the Batch documentation, or the JBeret documentation to learn about Batch Applications.

Configuration

The JBeret Quarkus extension supports the following configuration:

Name Type Default
quarkus.jberet.repository
The repository type to store JBeret and Job data. A jdbc type requires a JDBC datasource.
in-memory, jdbc in-memory
quarkus.jberet.repository.jdbc.datasource
The datasource name.
string <default>
quarkus.jberet.jobs.includes
A list of patterns to match batch files to include.
list of string
quarkus.jberet.jobs.excludes
A list of patterns to match batch files to exclude.
list of string
quarkus.jberet.job."job-name".cron
A cron style expression in Quartz format to schedule the job.
string
quarkus.jberet.job."job-name".params."param-key"
A parameter to start a job.
string

Non-standard Features

Simplified Configuration

The Batch API requires the @BatchProperty annotation to inject the specific configuration from the batch definition file. Instead, you can use the @ConfigProperty annotation, which is used to inject configuration properties in Quarkus using the MicroProfile Config API and keep consistency:

@Inject
@BatchProperty(name = "job.config.name")
String batchConfig;

// These is equivalent to @BatchProperty injection
@ConfigProperty(name = "job.config.name")
Optional<String> mpConfig;

Although, there is a slight limitation: since job configuration is mostly dynamic and only injected on job execution, Quarkus may fail to start due to invalid configuration (can't find the Job configuration values). In this case, configuration injection points with the @ConfigProperty annotation need to set a default value or use an Optional.

CDI Beans

The Batch APIs JobOperator and JobRepository are available as CDI beans, so they can be injected directly into any code:

@Inject
JobOperator jobOperator;
@Inject
JobRepository jobRepository;

void start() {
    long executionId = jobOperator.start("batchlet", new Properties());
    JobExecution jobExecution = jobRepository.getJobExecution(executionId);
}

Additional Beans

Specific Quarkus implementation is available in QuarkusJobOperator, which can be also injected directly:

@Inject
QuarkusJobOperator jobOperator;

void start() {
    Job job = new JobBuilder("programmatic")
            .step(new StepBuilder("programmaticStep")
                    .batchlet("programmaticBatchlet")
                    .build())
            .build();
    
    long executionId = jobOperator.start(job, new Properties());
    JobExecution jobExecution = jobOperator.getJobExecution(executionId);
}

With QuarkusJobOperator it is possible to define and start programmatic Jobs, with the JBeret Programmatic Job Definition.

Scheduler

The JBeret Scheduler is integrated out of the box in this extension.

To schedule a Job execution, please refer to the quarkus.jberet.job."job-name".cron and
quarkus.jberet.job."job-name".params."param-key" configurations.

A Job can also be scheduled programmatically, using the JobScheduler API and the Quarkus startup event:

@ApplicationScoped
public class Scheduler {
    @Inject
    JobScheduler jobScheduler;

    void onStart(@Observes StartupEvent startupEvent) {
        final JobScheduleConfig scheduleConfig = JobScheduleConfigBuilder.newInstance()
                .jobName("scheduler")
                .initialDelay(0)
                .build();

        jobScheduler.schedule(scheduleConfig);
    }
}

The JobScheduler does not support persistent schedules.

REST API

The JBeret REST is integrated as separate extension that can be easily added to the target project with the following dependency:

<dependency>
  <groupId>io.quarkiverse.jberet</groupId>
  <artifactId>quarkus-jberet-rest</artifactId>
  <version>0.0.4</version>
</dependency>

The JBeret REST API, provides REST resources to several operations around the Batch API: starting and stopping jobs, querying the status of a job, schedule a job, and many more. The extension includes a REST client to simplify the REST API calls:

@Inject
BatchClient batchClient;

void start() throws Exception {
    JobExecutionEntity jobExecutionEntity = batchClient.startJob("batchlet", new Properties());
}

Example Applications

Example applications can be found inside the integration-tests folder:

  • chunk - A simple Job that reads, processes, and stores data from a file.
  • jdbc-repository - A Job that uses a jdbc datasource to store JBeret and Job metadata.
  • scheduler - Schedule a Job to run every 10 seconds

Or take a look into the World of Warcraft Auctions - Batch Application. It downloads the World of Warcraft Auction House data and provides statistics about items prices.

Native Image Limitations

The Quakus JBeret Extension fully supports the Graal VM Native Image with the following exceptions:

  • Scripting Languages. While Javascript should work, it is unlikely that other scripting languages will be supported in Graal via JSR-223.

Contributors ____

Thanks goes to these wonderful people (emoji key):


Roberto Cortez

💻 🚧

This project follows the all-contributors specification. Contributions of any kind welcome!

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].