Skip to content
Weik.ioBlog
Try Weik.io

Moving separate Camel applications into Weik.io

Many teams that use Apache Camel run each integration as its own application, such as a Spring Boot or Quarkus service or a Camel JBang script on a server. Each of them has its own build and deployment, and logs in its own way. When you move such an integration into Weik.io, it becomes a folder of Camel files and gets versions, environments, logs, metrics and traces.

The example is the erp-invoice-export integration of a team called finance. It fetches pending invoices from an ERP every minute, and then maps and publishes them.

The folder

An integration in Weik.io is a directory. The route files go in as they are written in Camel's DSL. They can be YAML or XML files, or Java classes.

  • Java classes that the routes call go into beans/ for Weik.io to compile with javac.
  • Kamelets of this integration go into kamelets/.
  • Kamelets that several integrations share become project kamelets.
  • Static settings stay in application.properties.
  • Any other file the routes read, such as mapping.txt, arrives on the agent at the same path.

A README.md in the folder appears with its Mermaid diagrams on the integration's page in the admin UI.

The finance repository
finance/
  project.yaml
  variables/
    erp-url.yaml
  production/
    variables/
      erp-url.yaml
  erp-invoice-export/
    integration.yaml
    routes/
      fetch-invoices.camel.yaml
      transform.camel.yaml
      publish.camel.yaml
    beans/
      InvoiceMapper.java
    kamelets/
      erp-paging-source.kamelet.yaml
    application.properties
    mapping.txt
    README.md

The team keeps the folder in Git. Because a project.yaml at the top sets the project, no file below has to repeat it.

The dependencies

In the separate application the dependencies were in a pom.xml. In Weik.io the build resolves the Camel components your routes use. integration.yaml lists only what the routes don't show, a component used through a bean and third-party jars by their Maven coordinates. A jar that is in no repository goes anywhere in the folder, such as a libs/ folder. integration.yaml also sets the version and the Camel line.

erp-invoice-export/integration.yaml
name: erp-invoice-export
version: 1.0.0
camelVersion: "4.22.1"
requirements: { os: linux }
dependencies:
  - camel:jdbc                                        # a Camel component the routes don't reveal by URI
  - camel:http                                        # the routes call {{erp-url}}, so the build can't see the component
  - mvn:com.microsoft.sqlserver:mssql-jdbc:12.8.1.jre11

Because Weik.io resolves the jars once per version and keeps them by their SHA-256, two agents on one version run the same files. An agent fetches only the files it doesn't already have. An air-gapped installation resolves everything through its own Maven mirror.

The values

A separate application usually had a properties file per environment. In Weik.io the routes keep using Camel's own placeholders for values that come from Weik.io:

erp-invoice-export/routes/fetch-invoices.camel.yaml
- route:
    from:
      uri: timer:tick?period=60000
      steps:
        - setHeader: { name: Authorization, simple: "Bearer {{erp-api-key}}" }
        - to: "{{erp-url}}/api/invoices/pending"
        - to: direct:transform

A variable without an environment is the default. A variable with an environment overrides the default in that environment. Because each value is its own document, a developer who may edit devtest's values never sees production's.

finance/production/variables/erp-url.yaml
apiVersion: weik.io/v1
kind: variable
metadata: { name: erp-url, environment: production }
spec: { value: https://erp.example.internal }

Secrets have the same shape. You set them with the CLI so that their values never go into Git:

Terminal
$ weikio secret set finance/erp-api-key --env devtest
$ printf '%s' "$ERP_PROD_KEY" | weikio secret set finance/erp-api-key --env production
Target: https://hub.example, project finance (context), environment production (--env)
secret finance/erp-api-key set for production (revision 4183)

Run and deploy it

Before you publish the folder, weikio dev run runs it on your machine with Camel JBang on the integration's Camel line and devtest's values. --with-secrets adds the secrets the routes read and records each reveal in the audit log. When it works, publish an immutable version with weikio apply and run it in devtest with weikio deploy:

Terminal
$ weikio dev run ./finance/erp-invoice-export --env devtest --with-secrets
$ weikio apply -f ./finance/
Target: https://hub.example, project finance (from finance/project.yaml)
project finance unchanged
variable finance/erp-url created
variable production/finance/erp-url created
integration finance/erp-invoice-export created (version 1.0.0, built in 20.8 s)

Nothing new is running yet. To run it:
  weikio deploy -f ./finance --env devtest

$ weikio deploy finance/erp-invoice-export
Target: https://hub.example, project finance (context), environment devtest (context)
Deploying finance/erp-invoice-export 1.0.0 (latest) to devtest...
deployment devtest/finance/erp-invoice-export created (follows latest)
Agents: 1 of 1 running after 3.4 s

weikio promote finance/erp-invoice-export --from devtest --to production then moves the tested version to production without a new build. A team that keeps its integrations in Git has its pipeline run these commands. Its promotions are pull requests that change the version.

What the integration gets

  • Versions that can't change once published, and the exact jar set of each in weikio describe version
  • Promotion between environments without a rebuild, and weikio rollback to the previous version
  • Logs, metrics and traces through OpenTelemetry with the integration, version, environment and agent as labels
  • Problems raised when the integration fails or restarts in a loop, and when it stops handling messages
  • Two or more running copies on matching agents, or one copy at a time with Camel's master: component and a lock that Weik.io keeps
  • Roles that grant access down to this one integration
  • An audit log of every change

Book a technical call to go through your own Camel applications with the Weik.io team.

Sign in to the live demo

Sign in with the shared viewer account. It can open every screen of the example projects but can't change anything.

E-mail
viewer@demo.weik.io
Password
try-weikio-live-demo
Open the live demo