Skip to content

Commit

Permalink
0002684: Support Custom Jobs
Browse files Browse the repository at this point in the history
  • Loading branch information
klementinastojanovska committed Jul 7, 2017
1 parent a188f88 commit a59068e
Show file tree
Hide file tree
Showing 5 changed files with 63 additions and 2 deletions.
1 change: 1 addition & 0 deletions symmetric-assemble/src/asciidoc/configuration.ad
Expand Up @@ -37,6 +37,7 @@ include::configuration/conflicts.ad[]
include::configuration/transforms.ad[]
include::configuration/load-filters.ad[]
include::configuration/extensions.ad[]
include::configuration/jobs.ad[]
include::configuration/parameters.ad[]

ifdef::pro[]
Expand Down
60 changes: 60 additions & 0 deletions symmetric-assemble/src/asciidoc/configuration/jobs.ad
@@ -0,0 +1,60 @@

=== Jobs

In SymmetricDS, jobs are tasks that are scheduled to run by a job manager. These jobs do the majority of synchronization work for SymmetricDS. In addition to the built in jobs, you can create custom jobs in Configuration to run for specified node groups.

ifdef::pro[]
image::configuration/customJob.png[]
endif::pro[]

.Required Fields
Job Name:: The Job Name is a unique identifier to refer to the job

Job Type:: The type of job. Possible types are listed below.

[cols="<2,^1,<9", options="header"]
|===
|Type
|Provided
|Description

|BSH|x|A job that will compile and run a beanshell script.

|JAVA|x| A job that will compile and run a java script.

|SQL|x| A job that will compile and run a sql script.

|===

ifndef::pro[]
Requires Registration:: Boolean value that specifies whether the engine needs to be registered for this job to run.

Auto Start-Up:: Boolean value that determines whether this job should auto start.
endif::pro[]

Node Group:: Targets the job at a specific node group id. To target all groups, use the value of 'ALL'.

ifdef::pro[]
Schedule:: Specifies how often this job should run.
endif::pro[]

.Advanced Topics
Job Expression:: The payload of the job. For BSH jobs, this should be a beanshell script. For Java jobs, this should be Java code of a class which implements the IJob interface. For SQL jobs, this should be a sql script.

ifdef::pro[]
To add your job expression/script navigate to the Configure Jobs page, select your job and click the button "Edit Script". The following editor will appear.

image::configuration/editScript.png[]
endif::pro[]

ifndef::pro[]
Schedule:: Specifies how often this job should run.

.Custom Job Example
[source,sql]
----
insert into SYM_JOB ("job_name", "job_type", "requires_registration",
"job_expression", "default_schedule", "default_auto_start", "node_group_id")
values ('Java Job', 'JAVA', 1, <YOUR JOB EXPRESSION HERE>,'1000', 0, 'server');
----
endif::pro[]
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 2 additions & 2 deletions symmetric-core/src/main/resources/symmetric-schema.xml
Expand Up @@ -919,9 +919,9 @@

<table name="job" description="Defines custom jobs that can be executed in the SymmetricDS instance.">
<column name="job_name" type="VARCHAR" size="50" required="true" primaryKey="true" description="The unique name of the job" />
<column name="job_type" type="VARCHAR" size="10" required="true" description="The type of the job. Valid values are 'snapshot_replication', 'java' and 'bsh'. The system exclusively uses the 'built_in' job type." />
<column name="job_type" type="VARCHAR" size="10" required="true" description="The type of the job. Valid values are 'sql', 'java' and 'bsh'. The system exclusively uses the 'built_in' job type." />
<column name="requires_registration" type="BOOLEANINT" size="1" required="true" default="1" description="Does the engine need to be registered for this job to run?" />
<column name="job_expression" type="LONGVARCHAR" description="The payload of the job. For bsh (beanshell) jobs, this should be bsh script. For Java jobs, this should be Java code of a class which implements the IJob interface." />
<column name="job_expression" type="LONGVARCHAR" description="The payload of the job. For bsh (beanshell) jobs, this should be bsh script. For Java jobs, this should be Java code of a class which implements the IJob interface. For SQL jobs, this should be a sql script." />
<column name="description" type="VARCHAR" size="255" description="An optional description of the job for users of the system." />
<column name="default_schedule" type="VARCHAR" size="50" description="The schedule to use if no schedule parameter is found. Overridden by job.jobname.period.time.ms or job.jobname.cron." />
<column name="default_auto_start" type="BOOLEANINT" size="1" required="true" default="1" description="Determine if this job should auto start. Overridden by start.jobname.job." />
Expand Down

0 comments on commit a59068e

Please sign in to comment.