Skip to content

JDM configuration

synQup Core provides different ways to configure the Job Dispatcher Mappings (JDMs). This document describes the different ways to configure JDMs.

Central config service

If you are writing a module, you definitely should use the central config service to configure JDMs. The service is called JobDispatcherConfigService. It has a public method called getConfig() which returns the configuration for a specific JDM and environment. The returned configuration is an array.

Do not load the configuration directly from the database. The central config service supports different ways of extending the configuration. If you load the configuration directly from the database, you will not be able to extend the configuration.

Main configuration

There are 2 ways of defining the main configuration of a JDM:

  1. Directly in the job_dispatcher_mapping table. The column is called configuration.
  2. As a template. The column template_id references a template in the config_snippet table. The template (column: snippet_value) contains the main configuration. Basically, both snippet types (snippet and template) can be used as template. The snippet type is more of a categorization: snippet is a partial configuration, whereas template is a full template for a JDM.

The main configuration in job_dispatcher_mapping has higher priority than the template. If both are set, the main configuration will be used.

Ways of extending the configuration

The main configuration of a JDM is located in the job_dispatcher_mapping table. If you don't use config snippets or environments, the main config will be equal to the final config. Otherwise, the final config will be a merge of the main config and the config snippets and environment-specific configuration.

The priority of the configuration is as follows:

  1. Config providers - If you are using config providers, they will always have the highest priority.
  2. Overrides - No matter if you are using environment-specific configs or not, the overrides will always be applied.
  3. Environment-specific configuration - If you are using environment-specific configuration, it will have higher priority than the main configuration.
  4. Config snippets - If you are using config snippets, they will be merged with the main configuration.
  5. Main configuration - The main configuration is the base configuration. It has the lowest priority.

Config snippets

Parts of the configuration can be extracted to config snippets. The config snippets are stored in the config_snippet table. The main purpose is to use recurring configurations in different JDMs. An example is API credentials. If you have multiple JDMs that use the same API credentials, you can extract the credentials to a config snippet and reference the snippet in the JDMs.

Config snippets have a naming convention. The name of a config snippet must start and end with '%%'.

Override configuration keys

Overrides are located in the job_dispatcher_mapping table. The column is called override. The overrides will be applied to both environment-specific configuration and main configuration. If you want to remove a key from the configuration, you can set the value to null.

Environment-specific configuration

Environment-specific configuration is located in the job_dispatcher_mapping_config table. The tables has references to the job_dispatcher_mapping table and the environment table. The configuration in the job_dispatcher_mapping_config table will be merged with the main configuration. JDMs can thus have different configurations in different environments. This is useful if you have multiple target systems and the JDMs of different target systems just have a slight difference.

Config providers

Config providers are services that provide configuration. They must implement the interface JobDispatcherConfigProvider. Each config provider must have an implementation of the method supports() and getConfig(). Teh method supports() is used to check if the config provider supports a specific JDM. The method getConfig() is used to return the configuration.