Table of Contents | ||||||||||
---|---|---|---|---|---|---|---|---|---|---|
|
In the sample below there are two different approaches described how you can start jobs on a file event.
Using a file order source
See also Documentation
The job chain "job_chain_file_order_source" has a file order source watching for files in c:\temp\input with the file name extension ".txt". When a file arrives, an order for the job chain will be created. The file will be erased removed at the end of the job chain by the file sink node(s).
- Orders can not have additional parameters.
- Order processing starts when the file is detected, not after the file is completely written
<mscgen>
//file_order_source
msc {
...
- .
...
FileSystem label"File System", textcolouh1. "maroon", arctextcolour"maroon",
No Format |
---|
JobScheduler [labeh1. "JobScheduler", textcolour"navy", arctextcolouh1. "navy"],
Order [label"FileOrder", textcolouh1. "brown", arctextcolour"brown"],
|
JobChain labeh1. "JobChain", textcolour"orange", arctextcolouh1. "orange";
No Format |
---|
JobScheduler> FileSystem [labelh1. "(1) start file watching"];
FileSystem .. JobChain [label "waiting for files "];
|
FileSystemh1. > JobScheduler label "(2) file arrived";
No Format |
---|
JobSchedulerh1. > Order [label "(3) start order processing"];
Orderh1. > JobChain [label "(4) start node"];
JobChainh1. > JobChain [label "(5) start next node(s)"];
JobChainh1. > Order [label "(6) end jobChain"];
Orderh1. > JobScheduler [label "(7) process file sink"];
JobSchedulerh1. > FileSystem [label "(8) delete/move file"];
FileSystem .. JobChain [labelh1. "repeat waiting for files "];
|
}
</mscgen>
Using JITL Job JobSchedulerExistsFile
See also Documentation
<mscgen>
//file_order_event
msc {
No Format |
---|
width"900";
|
JobScheduler labeh1. "JobScheduler", textcolour"navy", arctextcolouh1. "navy",
No Format |
---|
JobChainPoll [label"JobChain Polling", textcolouh1. "orange", arctextcolour"orange"],
OrderPoll [labeh1. "Order for Pollling", textcolour"brown", arctextcolouh1. "brown"],
FileSystem [label"File System", textcolouh1. "maroon", arctextcolour"maroon"],
JobChainProcessing [labeh1. "JobChain Processing", textcolour"orange", arctextcolouh1. "orange"],
OrderProcessing [label"Order for Processing", textcolouh1. "brown", arctextcolour"brown"];
|
JobSchedulerh1. > JobChainPoll label "(1) start order for file watching";
No Format |
---|
JobScheduler .. FileSystem [labelh1. "waiting for files "];
|
OrderPoll> FileSystem labelh1. "(2) polling";
No Format |
---|
FileSystem> OrderPoll [labelh1. "(3) file arrived"];
OrderPoll> JobChainProcessing [labelh1. "(4) create order for processing"];
OrderProcessing> OrderProcessing [labelh1. "(5) check for ready state"];
|
OrderProcessing> JobChainProcessing labelh1. "(6) start node";
No Format |
---|
OrderProcessing> JobChainProcessing [labelh1. "(7) start next node(s)"];
OrderProcessing> JobChainProcessing [labelh1. "(8) end jobChain"];
OrderProcessing> JobChainProcessing [labelh1. "(9) process file sink"];
JobChainProcessing> FileSystem [labelh1. "(10) delete/move file"];
JobScheduler .. FileSystem [label "repeat waiting for files "];
OrderPollh1. > FileSystem [label "(11) polling"];
|
}
</mscgen>
The job chain the job chain "job_chain_file_order_source_poll" uses the job JobSchedulerExistsFile to check, wether whether a file is in c:\temp\input ending with .pdf. If so, for each file found, an order will be created for the job chain job_chain_file_order_source. The file will be erased removed by the sinks in the executed job chain.
- The created order have has the same parameters as the polling order
- The first step in the executed job chain checks, wether whether the file is completly written.
Please note, that you can mix file_order_source and JobSchedulerExistsFile by using JobSchedulerExistsFile in the first node to check, whether the file is has been completly written.