Scope
- Use Case
- A number of orders that have been added to a job chain - either from a file order source watching incoming files, from Ad Hoc orders or from permanent orders - should be forced into serialized processing in a predefined sort order.
- Solution Outline
- A single job is added to the top of a job chain and that will
- suspend all incoming orders and check completeness until a predefined idle timeout is reached and no more orders are expected,
- sort the orders in alphabetical sequence of the order id and move them to the next job node in the job chain.
- A single job is added to the top of a job chain and that will
- References
Solution
- Download sort_orders.zip
- Extract the archive to any folder within the
./config/live
folder of your JobScheduler installation. - The archive will extract the files to a folder
sort_orders.
- You can store the sample files to a any folder as you like, the solution does not make use of specific folder names or job names.
Pattern
Implementation
Components
- The solution implements a job
sorter
that can be added to the top 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 incoming orders sequentually.
- Having received the last available order this job waits for the duration specified with the
idle_timeout
attribute for new orders.- The idle timeout is configured by
<job idle_timeout="10">
with thesorter
job definition. - With the idle timeout being expired this job will execute its
spooler_exit()
function and will 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
- This job implements a
- The sample makes use of a job chain
job_chain1
that includes the job nodes for thesorter
job and ahello
job. The job chain accepts Ad Hoc orders that are added by use of JOC and the job chain can easily be modified to watch for incoming files and to create one order for each file.
Usage
- Add two orders to the
job_chain1
job chain.- Use an order id in descending alphabetical order, e.g. "cba" for the order id of the first order and "abc" for the order id of the second order.
- Both orders will be suspended in the first node of the job chain.
- After an idle timeout of 10s both orders are moved to the next job node in the job chain.
- This time the orders are processed in ascending alphabetical order.