Feature Review #002: Job Keys
What are Job Keys?
Job keys are a useful utility feature in CIOS that allow you to tag values to each job that runs. Tagging a job with a particular key allows you to search for that key on the WMC to find the job. The primary key is also displayed in job list views in the WMC.
Using Job Keys
Creating and using Job Keys in CI Studio is a simple two step process:
- Managing Available Job Keys: Open your orchestration and click the green starter dot (see the screenshot below). This will bring up the orchestration pane, in the first section you will see the list of job keys. To add a job key click add. There is a checkbox to make a particular key the primary key, note that only one key can be primary you will have to uncheck it to select a different key. Select the key and click the Remove button to remove a key.
- Creating Job Keys: To create a job key simply use the Create Job Keys activity and map a value to the key that you want to create. Note the name of the activity, Create Job Keys and not set job keys, indicates that each time you use this activity a new job key with that value will be created. If you call it twice for a single key you will see two values for that key in the WMC after the job runs.
|Click the green starter dot to manage available job keys.|
|Use the Create Job Keys activity to set your job keys.|
Design PatternsJob keys allow your jobs to be searchable in the WMC. Therefore, job keys are very useful when storing cross reference information. For example, if you a writing an orchestration to sync accounts between SAP and salesforce it may be useful to store an account id, for example, as a job key to quickly allow you to see when the last time an account was synced. In the same example, it may also be useful to store the IDoc number in order to trace an IDoc through the system.
The primary job key is what will be displayed in the WMC in job list views. Therefore, setting a meaningful primary key will help you to distinguish one job from the next. It is also a good place to display status information about the jobs that have completed. This is especially true for batch jobs. For batch jobs it is very useful to use the primary key to indicate how many items within a batch where processed successfully, had warnings or errors, etc. To accomplish this all you need to do is add a job key called status and make it primary. Then calculate the number of successes, warnings, and errors and map them in the Create Job Keys activity using a concatenate function to form a string like: Batch Job Complete. success: 5, warn: 2, error: 1.
Avoid overuse of this feature, as noted above once the create job keys activity is called the job key is logged permanently. If you are processing hundreds or thousands of items within a batch job, it might seem like a good idea to log a key for each item, however, this can create a dramatic drag on the performance of your orchestration which may not be immediately evident (due to the fact that logging is asynchronous and indexing job keys by the logging system is an expensive operation). Instead, use status summary design pattern to track aggregate status or an external database for logging if you need that level of detail for batch processes.