Source

On this page, you will find:

  • Overview: discover the functionality of all screen elements.

  • Script editor: learn how to add a script in the editor and perform other actions.

  • Source folder structure: learn which files make up the Source project and how an integration can include multiple files.

Overview

Get to know the interface and elements of the Source screen to create and deploy your integrations:

source flow overview

  1. Script editor: editing box to add integration scripts. The main.yaml label above the editing box indicates that this is the main integration file.

  2. Errors: displays existing errors in the structure of the main integration script file after performing a validation.

  3. Source:

    • Flow: folder that contains the main integration flow script file.

    • Resources: folder to create and store files with additional scripts.

    • Flow Variables: registry of variables applied to the integration flow in the Production and Staging environments.

  4. Source Code: mode for creating and viewing the integration in code format.

  5. Diagram: mode for viewing the integration in diagram format. It does not offer editing functionalities.

  6. Fields in the upper left corner:

    • Name: displays the current flow name.

    • Version: displays the current flow version.

  7. Menu options in the upper right corner:

    • Save All: saves the entire project (the main.yaml script and additional files).

    • Deploy: deploys the current integration flow.

    • Additional settings gearIcon:

      • Description: adds or edits the flow description.

      • Deployments: accesses the Deployments screen.

      • Delete: deletes the current flow and all additional files.

Script editor

Here you should add the integration scripts.

source flow editor

The label displayed above the editor varies according to the file you are working on. If you are editing the main flow file, you will see the name main.yaml, as shown in the image. If you are working on a file in the Resources folder named as transformation.jsonata, that name will be displayed.

In the upper right corner of the editor, you will find some icons that perform actions on the current file’s script:

  • validate icon(Full Validation): checks the structure of your script before deploying the integration flow. Any errors in the flow structure or the use of restricted components or EIPs will be identified and listed at the bottom of the page in Errors.

This feature is only available for the main.yaml script file.
  • save icon(Save File): saves the current file’s script.

  • duplicate icon(Duplicate): duplicates the current file’s script.

  • delete icon(Delete): deletes the current file’s script.

Source folder structure

source flow source folder

The main.yaml file is just one part of your Source project, which can contain other important files.

You can view the folder structure on the left side of the editor:

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 env variables hello

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

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

source env variables url1

Thanks for your feedback!
EDIT

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