...
Info | ||
---|---|---|
| ||
|
Example: File Transfer using JITL Job
The following scenario is given:
- Job Scheduler JobScheduler reads a status information from an Oracle database table scenario1 where we store values every 5 minutes
- For this demo we handle the table as if there were just one row of data.
...
- read additional FTP attributes from an database table, i.e. SourceFilePath, SourceFileName, TargetFilePath, TargetFileName, EncryptedYN.
- store FTP attributes as memory variables for later use.
- call JADE YADE to transfer files by SFTP using its configuration from the stored memory variables.
- If SourceFile does not exist
- send e-mail indicating the error including the file properties (source file name, source file size, source file date/time created, date/time of failure, target file name, target directory, failure detail)
- If SourceFile does exist
- If EncryptedYN has the value
Y
- execute encryption routine
- perform SFTP file transfer to target system
- confirm that the file has been successfully received at the destination.
- If the file has not been successfully received at the destination
- send mail indicating the error that occurred including the file properties (source file name, source file size, source file date/time created, date/time of failure, target file name, target directory, failure detail)
- If the file has been successfully received
- send a confirmation mail including the file properties (source file name, source file size, source file date/time created, date/time of failure, target file name, target director)
- If EncryptedYN has the value
- Log All transport activities
- Create PDF report of all transport activities between two dates/times
Representation of the Solution
Graphviz |
---|
digraph "Example: File Transfer using JADEYADE JITL Job" { graph [rankdir=TB] node [fontsize=10] node [style=filled,fillcolor=aquamarine] checkDB [shape=Mrecord, label="{checkDB | {<GO>GO|<no_GO>no_GO }}"] checkEncrypted [shape=Mrecord, label="{checkEncrypted | {<Yes>Yes|<No>No}}"] checkDB:GO -> checkEncrypted checkDB:no_GO -> WAITING checkEncrypted:Yes -> transportSourceToLocal -> encrypt -> transportLocalToTarget -> report checkEncrypted:No -> transportSourceToTarget -> report } |
Components of the Solution
checkDB: Access to Oracle database using pl/sql
For the connection to the Oracle™ DBMS we use the pl/sql script plsql_script.txt which is executed by the Java adapter class sos.scheduler.db.JobSchedulerPLSQLJobJSAdapterClass.
...
Code Block | ||
---|---|---|
| ||
function spooler_process_after(spooler_process_result) { var params = spooler_task.order().params(); var status = params.value("status"); if ( status == "GO" ) { spooler_log.info("Table status is \"GO\", continue!"); } else { spooler_log.info("Waiting until table status is \"GO\" ..."); spooler_task.order().set_state("WAITING"); } return spooler_process_result; } |
CheckFileExists: check if file exists
- The file defined by the parameters SourceFilePath and SourceFileName is checked with the JITL job sos.scheduler.file.JobSchedulerExistsFile.
checkEncrypted: Interpretation of Parameter encryptedyn
The value of the parameter encryptedyn decides whether the file is to be encrypted or not. The encryption is done for a local copy of the file, therefore different steps of the job chain are used. The functions are part of the job checkEncrypted programmed in javax.script:rhino.
...
Without encryption only one transfer is used to copy the file from source to target in step
- transportSourceToTarget
Transport Steps
The transport steps are using the JITL job sos.scheduler.jade.JadeJob.
The following parameters are required as per step:
encrypt: encryption of the local file
In our example the encryption is only simulated. An own routine may be used here.
Report: Mailing a report
A mail is generated to send the JADE YADE history file as an example for a report. External report features may be used here. The JITL job sos.scheduler.managed.JobSchedulerManagedMailJob is used here to manage the mail.
JobChain in JOE