...
- Use Case:
- Consider the situation where a number of orders that have been added to a job chain - either from a file order source watching incoming files, or from Ad Hoc orders ad hoc or from permanent orders - and that these . These orders should be forced into serialized processing with then be processed serially in a predefined sorting order.
- Solution Outline:
- A single job is added at the start of a job chain that will:
- suspend all incoming orders and check completeness until a predefined idle timeout has beens reached and no more orders are expected,
- sort the orders in alphabetical sequence according to the order ID and move them to the next job node in the job chain.
- A single job is added at the start of a job chain that will:
- References
...
- Download sort_orders.zip
- Extract the archive to any folder within the
./config/live
folder of your JobScheduler installation. - The archive will extract extracts the files to a folder named
sort_orders.
- You can store the sample files in any folder as you like, the solution does not make use of specific folder or job names.
...
- The solution implements a job named
sorter
that can be added to at the top start of any job chain.- This job implements a
spooler_process()
function that suspends all incoming orders. - This job is configured for a single task and with an idle timeout attribute, i.e. it executes . This means that it will execute incoming orders sequentuallysequentially.
- Having received the last available order this job waits will wait for the duration specified with the
idle_timeout
attribute for new orders.- The idle timeout is configured by using, for example
<job idle_timeout="10">
with thesorter
job definition. - With Once the idle timeout being has expired this job will execute its
spooler_exit()
function and will then sort and move all orders that have previously been suspended.- Sorting is done in alphabetical order.
- The orders are moved to the next job chain node that follows the
sorter
job in the job chain.
- The idle timeout is configured by using, for example
- This job implements a
- The sample makes use of download example uses a job chain named
job_chain1
that includes the job nodes for thesorter
job and ahello
job. The This job chain accepts Ad Hoc ad hoc orders that are added by use of JOC and the job chain it can easily be modified to watch for incoming files and to create one an order for each file. - Hint: to re-use the
sorter
job you can:- store the job to some in a central folder and reference the job in individual job chains.
- move the job's JavaScript code of the job to come a central location and use a corresponding
<include>
element for individual job scripts.
...