Source Project

The integration flow script is just a part of your Source project, which may have other important files.

You can view the project’s folders on the left side of the main.yaml board:

folder structure

Flow

The Flow folder contains the main integration flow file: main.yaml. Only one main.yaml file is allowed per project. This file cannot be renamed or deleted.

Resources

For some Apache Camel components, such as "JSONata", it is necessary to use scripts stored in separate files. These files can be created in the Resources folder, regardless of the file extension. This way, you can reference them directly within the main flow, ensuring they are used during the execution of the integration flow.

All the files added to the Resources folder are automatically added to the integration’s classpath and should be referenced using classpath locators, according to each component documentation.

Creating a file

To create a file, follow the steps below:

  1. Click on the + button, to the right of the folder’s name.

  2. Specify the file name and extension: for example, jsonata.yaml, test.txt, etc.

A yellow dot icon on the right side of the file name indicates that the file has not been saved.
Whereas a red dot icon indicates that there are errors in the file.

File name requirements

The file name must meet the following criteria:

  • Maximum size: 100 characters.

  • Allowed characters: alphanumeric,-,_, and ..

  • Uniqueness: each file name must be unique, but you can have, for example, test.yaml and test.json.

Extension Types

  • If the file extension is .yaml, .json or .xml, it will be formatted with colors and layout. If the structure is incorrect, a notification will be displayed.

  • If the file extension is different from those mentioned, the file will not be validated. However, you can create your script normally.

Limits

  • There is no limit to the number of files the folder can contain.

  • A file can have a maximum size of 1 MB.

Flow variables

In this folder, you can create and manage the variables for your integration flow. These variables allow for a customized flow configuration and environment parameterization, eliminating the need to create a separate integration flow for each environment.

If your flow has a REST trigger, it will not be possible to use environment variables in the URI.

Creating a variable

To create a variable, follow the steps below:

  1. Select the environment: click the name of the environment in which the variable will be applied: Production or Staging.

    • A modal window will open with a registration form.

  2. Fill in the fields:

    • Variable: variable name. Alphanumeric field. You can use the characters . and _.

    • Value: value assigned to the variable, which will be deployed automatically according to the environment you selected.

  3. Save the variable: click SAVE.

  4. Reference the variable: in the flow script, in the main.yaml file, reference the variable you created.

To apply the registered variables, reference them in the integration flow script by entering the name of the component, as in the examples below:

  • uri: "http://{{variable name}}" or

  • uri: "jsonata:{{variable name}}"

Managing variables

  • To add more than one variable, click the + button in the right corner.

  • To delete a variable, click the trash icon.

  • To hide a variable, click the eye icon.

You cannot change the variables of a deployed flow with a Deployed status. To change them, you must deploy the flow again.

Blocked variables

The variables listed below are reserved for internal use and cannot be used:

AWS_ACCESS_KEY_ID
AWS_SECRET_ACCESS_KEY
AWS_REGION
AWS_DEFAULT_REGION
RESOURCES_DIR
CAMEL_* (any variable that begins with CAMEL_)

Examples

The example below references the variable "name". During the execution of this integration, the variable will be replaced with the registered name.

- from:
    uri: "rest:get:/hello"
    steps:
    - log:
          message: "Hello {{name}}"

source variables

source env variables 1

In this other example, we reference a variable in a URL.

- to:
                id: to-generic
                uri: "https://{{url1}}"
                parameters:
                  httpMethod: POST

source env variables 2

Thanks for your feedback!
EDIT

Share your suggestions with us!
Click here and then [+ Submit idea]