...
Flowchart |
---|
chain_resource_lock [label="Job Chain\nimplements\na Resource Manager",fillcolor="orange"] job_manage_resource_lock [label="Job Manage Resource Lock",fillcolor="lightskyblue"] resource_lock_available [shape=diamond,label="Resource Lock available?",fillcolor="white"] chain_resource_lock_consumer_1 [label="Job Chain\nimplements a\nResource Lock Consumer",fillcolor="orange"] job_request_resource_lock_1 [label="Job Request Resource Lock",fillcolor="lightskyblue"] job_step_1_1 [label="Job Step 1",fillcolor="lightskyblue"] job_step_1_2 [label="Job Step 2",fillcolor="lightskyblue"] chain_resource_lock_consumer_2 [label="Job Chain\nimplements a\nResource Lock Consumer",fillcolor="orange"] job_request_resource_lock_2 [label="Job Request Resource Lock",fillcolor="lightskyblue"] job_step_2_1 [label="Job Step 1",fillcolor="lightskyblue"] job_step_2_2 [label="Job Step 2",fillcolor="lightskyblue"] order_1A [shape="ellipse",label="Order 1A",fillcolor="violet"] order_1B [shape="ellipse",label="Order 1B",fillcolor="violet"] order_2A [shape="ellipse",label="Order 2A",fillcolor="violet"] order_2B [shape="ellipse",label="Order 2B",fillcolor="violet"] shadow_order_1A [shape="ellipse",label="Shadow Order 1A",fillcolor="violet"] shadow_order_1B [shape="ellipse",label="Shadow Order 1B",fillcolor="violet"] shadow_order_2A [shape="ellipse",label="Shadow Order 2A",fillcolor="violet"] shadow_order_2B [shape="ellipse",label="Shadow Order 2B",fillcolor="violet"] order_suspend [label="Suspend Original Order",fillcolor="white"] order_move [label="Move OrdersOriginal Order to Next Job",fillcolor="white"] chain_resource_lock_consumer_1 -> order_1A chain_resource_lock_consumer_1 -> order_1B order_1A -> job_request_resource_lock_1 -> job_step_1_1 order_1B -> job_request_resource_lock_1 -> job_step_1_2 job_request_resource_lock_1 -> shadow_order_1A job_request_resource_lock_1 -> shadow_order_1B chain_resource_lock_consumer_2 -> order_2A chain_resource_lock_consumer_2 -> order_2B order_2A -> job_request_resource_lock_2 -> job_step_2_1 order_2B -> job_request_resource_lock_2 -> job_step_2_2 job_request_resource_lock_2 -> shadow_order_2A job_request_resource_lock_2 -> shadow_order_2B chain_resource_lock -> shadow_order_1A chain_resource_lock -> shadow_order_1B chain_resource_lock -> shadow_order_2A chain_resource_lock -> shadow_order_2B shadow_order_1A -> job_manage_resource_lock shadow_order_1B -> job_manage_resource_lock shadow_order_2A -> job_manage_resource_lock shadow_order_2B -> job_manage_resource_lock job_manage_resource_lock -> resource_lock_available resource_lock_available -> order_move [label=" yes "] resource_lock_available -> order_suspend [label=" no "] order_move -> job_step_1_1 -> job_step_1_2 order_move -> job_step_2_1 -> job_step_2_2 |
Implementation
Components
- The solution implements a job named
sorter
that can be added at the 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. This means that it will execute incoming orders sequentially.
- Having received the last available order this job will wait for the duration specified with the
idle_timeout
attribute for new orders.- The idle timeout is configured using, for example
<job idle_timeout="10">
with thesorter
job definition. - Once the idle timeout has expired this job will execute its
spooler_exit()
function and 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 using, for example
- This job implements a
- The download example uses a job chain named
job_chain1
that includes the job nodes for thesorter
job and ahello
job. This job chain accepts ad hoc orders that are added by JOC and it can easily be modified to watch for incoming files and to create an order for each file. - Hint: to re-use the
sorter
job you can:- store the job in a central folder and reference the job in individual job chains.
- move the job's JavaScript code to a central location and use an appropriate
<include>
element for individual job scripts.
...