Deploying Apama applications with a YAML configuration file
Instead of having another process inject code and send events into a correlator at startup, it is also possible to use a YAML configuration file to list files to be loaded by the correlator at startup. This is useful for Docker containers or other minimal environments where only part of an Apama installation is available or it is not practical to run Java tools to perform the injections. It is also a better fit for Docker use cases as the correlator does not require any other coordination process for startup. For typical installations not using such environments, use of Ant macros or Command Central is recommended instead, which perform the injections after starting the correlator.
The YAML configuration file for the correlator is specified using the
--config option when starting the correlator (see also
Starting the correlator). The YAML file itself contains the following:
correlator:
initialization:
list:
- ${PARENT_DIR}/bin/myPlugin.jar
- ${PARENT_DIR}/eventdefinitions/evtdef.mon
- ${APAMA_HOME}/monitors/ConnectivityPlugins.mon
- ${PARENT_DIR}/monitors/app.mon
- ${PARENT_DIR}/events/start.evt
encoding: UTF8
It is recommended to use a substitution variable such as ${APAMA_HOME} or ${PARENT_DIR} rather than absolute or relative paths. This makes the configuration independent of the correlator's current working directory.
The list entries must have one of the following extensions:
.mon for EPL monitor, aggregate and event definition source.
.jar for EPL plug-ins written in Java.
.cdp for correlator deployment packages.
.evt for event files.
Apama queries (.qry) are not supported in source form. Digital events have to be generated into EPL, and the generated EPL needs to be listed in the YAML configuration.
Note:
If you use the
engine_deploy tool, EPL code is automatically generated from query files. For further information, see
Deploying a correlator.
Apama queries are deprecated and will be removed in a future release.
The encoding entry is optional. If UTF8 is specified, all of the text input files (.mon, .evt) are read as UTF-8. If local is specified or if the encoding entry is not specified at all, the text files are assumed to be in the local encoding unless they start with a UTF-8 byte order mark (BOM) in which case they are treated as UTF-8.
This mechanism separates the build-time (calculating injection order, generating EPL) steps from the deployment-time steps, so no build steps are required in the environment where the correlator is running. This does mean that any changes to the project potentially require rewriting the YAML list and then redeploying, however, it allows separation of these concerns.
Note:
The correlator port is opened before the injections have completed. This allows monitoring tools to connect while the injections occur, but this also means that the correlator may not be entirely ready when a client connects. You can use the
flushAllQueues request (see
Shutting down and managing components) to wait for the injections to complete.