Skip to end of metadata
Go to start of metadata

Question

I would like to use variable path names when configuring a job chain. For example, to make the following job chain easier to use, I would like to neutralise the default local path:

 <?xml version="1.0" encoding="ISO-8859-1"?>
 <job_chain  orders_recoverable="yes" visible="yes"  title="com-ems-web-export" max_orders="1">
    <file_order_source   directory="C:/Windows/Temp/orders/start" regex="\.jobstart.xml$"  max="1"/>

    <job_chain_node  state="step_1"  job="/test/step_1_job" next_state="step_2"  error_state="error"/>
    <job_chain_node  state="step_2"  job="/test/step_2_job" next_state="step_3"  error_state="error"/>
    <job_chain_node  state="step_3"  job="/test/step_3_job" next_state="step_4"  error_state="error"/>
    <job_chain_node  state="step_4"  job="/test/step_4_job" next_state="success"  error_state="error"/>

    <file_order_sink  state="error"  move_to=":/Windows/Temp/orders/error"/>
    <file_order_sink  state="success"  move_to="/test/orders/success"/>
 </job_chain>

Answer

You can achieve this using environment variables.
For example:

 <?xml version="1.0" encoding="ISO-8859-1"?>
 <job_chain  orders_recoverable="yes" visible="yes" title="VariableFileOrderSource" name="VariableFileOrderSource" max_orders="1">
    <file_order_source  directory="${temp}/orders/start" regex="\.jobstart.xml$"  max="1"/>

    <job_chain_node  state="step_1"  job="/test/step_1_job" next_state="step_2"  error_state="error"/>
    <job_chain_node  state="step_2"  job="/test/step_2_job" next_state="step_3"  error_state="error"/>
    <job_chain_node  state="step_3"  job="/test/step_3_job" next_state="step_4"  error_state="error"/>
    <job_chain_node  state="step_4"  job="/test/step_4_job" next_state="success"  error_state="error"/>

    <file_order_sink  state="error"  move_to="${temp}/orders/error"/>
    <file_order_sink  state="success"  move_to="${temp}/orders/success"/>
 </job_chain>

JobScheduler recognises these variables from the ${....} and replaces them. Note that they must have been defined in the environment before or when JobScheduler is started.

See also:

 

Write a comment…