So you want to contribute code to this project? Excellent! We're glad you're here. Here's what you need to do.
Fork this repository on GitHub, and clone locally with git clone.
OpenSearch components build using Java 11 at a minimum. This means you must have a JDK 11 installed with the environment variable JAVA_HOME referencing the path to Java home for your JDK 11 installation, e.g. JAVA_HOME=/usr/lib/jvm/jdk-11.
- Check out this package from version control.
- Launch Intellij IDEA, choose Import Project, and select the
settings.gradlefile in the root of this package. - To build from the command line, set
JAVA_HOMEto point to a JDK >= 11 before running./gradlew.
-
Unix System
export JAVA_HOME=jdk-install-dir: Replacejdk-install-dirwith the JAVA_HOME directory of your system.export PATH=$JAVA_HOME/bin:$PATH
-
Windows System
- Find My Computers from file directory, right click and select properties.
- Select the Advanced tab, select Environment variables.
- Edit JAVA_HOME to path of where JDK software is installed.
The JobScheduler plugin uses the Gradle build system.
- Checkout this package from version control.
- To build from command line set
JAVA_HOMEto point to a JDK >=11 - Run
./gradlew build
Then you will find the built artifact located at build/distributions directory
Once you have built the plugin from source code, run
opensearch-plugin install file:///path/to/target/releases/opensearch-job-scheduler-<version>.zipto install the JobScheduler plugin to your OpenSearch.
JobScheduler plugin provides a SPI for other plugins to implement. Essentially, you need to
- Define your JobParameter type by implementing
ScheduledJobParameterinterface - Implement your JobParameter parser function that can deserialize your JobParameter from XContent
- Create your JobRunner implementation by implementing
ScheduledJobRunnerinterface - Create your own plugin which implements
JobSchedulerExtensioninterface- don't forget to create the service provider configuration file in your resources folder and bundle it into your plugin artifact
Please refer to the sample-extension-plugin subproject in this project, which provides a complete
example of using JobScheduler to run periodical jobs.
The sample extension plugin takes an index name as input and logs the index shards to opensearch logs according to the specified Schedule. And it also exposes a REST endpoint for end users to create/delete jobs.
Launch Intellij IDEA, choose Import Project, and select the settings.gradle file in the root of this package.
See CONTRIBUTING.