You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@fineract.apache.org by ar...@apache.org on 2022/11/24 11:40:21 UTC

[fineract] branch develop updated: FINERACT-1678--Extending-jobs-with-module-system-documentation

This is an automated email from the ASF dual-hosted git repository.

arnold pushed a commit to branch develop
in repository https://gitbox.apache.org/repos/asf/fineract.git


The following commit(s) were added to refs/heads/develop by this push:
     new a1a643528 FINERACT-1678--Extending-jobs-with-module-system-documentation
a1a643528 is described below

commit a1a643528361f8bbf32123f0125d736633ece522
Author: Ruchi Dhamankar <ru...@gmail.com>
AuthorDate: Thu Nov 24 14:52:16 2022 +0530

    FINERACT-1678--Extending-jobs-with-module-system-documentation
---
 .../docs/en/chapters/custom/custom-batch-job.adoc  | 79 ++++++++++++++++++++++
 .../src/docs/en/chapters/custom/index.adoc         |  2 +
 2 files changed, 81 insertions(+)

diff --git a/fineract-doc/src/docs/en/chapters/custom/custom-batch-job.adoc b/fineract-doc/src/docs/en/chapters/custom/custom-batch-job.adoc
new file mode 100644
index 000000000..5466a8887
--- /dev/null
+++ b/fineract-doc/src/docs/en/chapters/custom/custom-batch-job.adoc
@@ -0,0 +1,79 @@
+= Custom Batch Jobs
+
+Fineract provides extension points to define custom batch jobs using module system. Using this approach custom batch jobs can be defined and configured along with Fineract's default batch jobs to extend or customize batch processing.
+
+The batch jobs in Fineract are implemented using https://docs.spring.io/spring-batch/docs/current/reference/html/[Spring Batch]. In addition to the Spring Batch ecosystem, automatic scheduling is done by http://www.quartz-scheduler.org/[Quartz Scheduler] but it's also possible to trigger batch jobs via regular APIs.
+
+For defining custom job:
+
+1. Create custom module (e. g. `custom/acme/loan/job`), follow the instructions on how to create a custom module.
+2. Create job configuration to register job, job steps, tasklet with job builder factory. (e. g. `com.acme.fineract.loan.job.AcmeNoopJobConfiguration`)
+3. Create tasklet for job execution functionality. (e.g. `com.acme.fineract.loan.job.AcmeNoopJobTasklet`)
+4. Provide the custom database migration to add necessary information about your job in table `job`. (e.g. `custom/acme/loan/job/src/main/resources/db/custom-changelog/0001_acme_loan_job.xml`)
+5. New job name should be registered along with default jobs so that it can be scheduled at startup. For registering job name with Fineract job scheduler, create an enum with job name details (e.g. `com.acme.fineract.loan.job.AcmeJobName`) and a job name provider configuration which is accessed by Fineract job scheduler at startup to retrieve job name (e.g. `com.acme.fineract.loan.job.AcmeJobNameConfig`).
+
+== Job Configuration
+
+.Job Configuration Example
+[source,java]
+----
+include::{rootdir}/custom/acme/loan/job/src/main/java/com/acme/fineract/loan/job/AcmeNoopJobConfiguration.java[lines=19..]
+----
+
+== Tasklet Definition
+
+.Job Tasklet Example
+[source,java]
+----
+include::{rootdir}/custom/acme/loan/job/src/main/java/com/acme/fineract/loan/job/AcmeNoopJobTasklet.java[lines=19..]
+----
+
+== Database Migration Script for Job
+
+.Database Migration Script Example
+[source,xml]
+----
+include::{rootdir}/custom/acme/loan/job/src/main/resources/db/custom-changelog/0001_acme_loan_job.xml[lines=22..]
+----
+
+== Job Name Configuration
+
+.Job Name Enum Example
+[source,java]
+----
+include::{rootdir}/custom/acme/loan/job/src/main/java/com/acme/fineract/loan/job/AcmeJobName.java[lines=19..]
+----
+
+.Job Name Provider Configuration Example
+[source,java]
+----
+include::{rootdir}/custom/acme/loan/job/src/main/java/com/acme/fineract/loan/job/AcmeJobNameConfig.java[lines=19..]
+----
+
+== Gradle Build Files
+
+Please make sure that your module libraries have proper `build.gradle` and `dependencies.gradle` files:
+
+.Example (`build.gradle`)
+[source,groovy]
+----
+include::{rootdir}/custom/acme/loan/job/build.gradle[lines=19..]
+----
+
+.Example (`dependencies.gradle`)
+[source,groovy]
+----
+include::{rootdir}/custom/acme/loan/job/dependencies.gradle[lines=19..]
+----
+
+== Deployment
+
+Custom modules can be deployed using docker image. See chapter about deploying custom modules in this documentation.
+
+.Example command to build docker image
+[source,bash]
+----
+./gradlew :custom:docker:jibDockerBuild
+----
+
+NOTE: See also chapter about batch jobs in this documentation.
diff --git a/fineract-doc/src/docs/en/chapters/custom/index.adoc b/fineract-doc/src/docs/en/chapters/custom/index.adoc
index 12bd1eb08..8f4b00a02 100644
--- a/fineract-doc/src/docs/en/chapters/custom/index.adoc
+++ b/fineract-doc/src/docs/en/chapters/custom/index.adoc
@@ -10,6 +10,8 @@ include::business-step.adoc[leveloffset=+1]
 
 include::loan-transaction-processor.adoc[leveloffset=+1]
 
+include::custom-batch-job.adoc[leveloffset=+1]
+
 include::database-migration.adoc[leveloffset=+1]
 
 include::deployment.adoc[leveloffset=+1]