Classes

You can define classes that can be deployed to IntegrationManager and used in routes via a Bean reference.

The solution is currently limited to Groovy classes with imports from basic Camel libraries.

The section consists of: 

  • Instance Repository tab shows already deployed classes. To change one, create a local copy, edit it in the Workspace and deploy it.
    For easier troubleshooting, you can also see here invalid classes and their definitions (i.e. classes which had issues during deployment) and create a local copy also for a failed class.

  • Workspace tab shows new or locally edited classes that have not been deployed yet. Available options: 

    • Edit a class. See an example below. After you finish editing, you can save and deploy the class directly into the Instance Repository. Or if you just save it, it is available locally in the Workspace and can be deployed later.

    • Deploy a class. 

    • Copy a class.

    • Delete a class. Deleting a class from Workspace after it was deployed is supported only in IntegrationManager 3.1.0 and higher.

Limitations

Due to security reasons, we use the Groovy sandbox as a running environment for all custom classes. You can use only whitelisted classes inside your custom Groovy code. A list of the classes is described here.

Groovy sanbox

The Groovy Sandbox is a security feature in the Groovy programming language designed to provide a controlled execution environment for running potentially untrusted or arbitrary scripts. It restricts access to certain classes and methods to prevent malicious code from performing harmful actions or accessing sensitive resources. The Groovy Sandbox is commonly used in applications where user-generated scripts need to be executed safely, such as in automation, testing frameworks, and content management systems. By employing the Groovy Sandbox, developers can strike a balance between flexibility and security when executing dynamic scripts within their applications.

When you need to extend the list of whitelisted classes, log a ticket in Jira describing the use case of the class and assign it to the Integrations team.

Classes cannot have any static variables, such as constants or log. Having such variables would result in ExceptionInInitializerError.

Use

Defining classes in PlatformManager has several benefits. When you deploy a class to IntegrationManager, you can use it directly in the integration.

Example

You need to do some data transformation in a route, but IM does not support it.

  1. Define a class which transforms the body (or any other action):

     

  2. Check that the class is deployed:

     

  3. Use the class in the route:

     

  4. When the route is executed, the processor is part of the route.

PlatformManager version 1.67.0