DevOps

Apache Camel is an open source integration framework based on well known Enterprise Integration Patterns. It allows us to define routing rules in various domain-specific languages (such as YAML, XML, Java, etc).

To easily run integrations (Camel routes) built with Apache Camel there exists Camel JBang, a JBang based application. We are aiming the Visual Studio Code, one of the most popular source code editors, which are lightweight, powerful and able to run on your desktop.

In this article we will discuss the Extension Pack for Apache Camel provided by Red Hat. This collection of extensions was chosen to simplify Camel developer experience in VS Code. For basic scenario we will need namely three extensions from this pack:

Create an integration

The Language Support for Apache Camel extension for VS Code is adding new Camel commands. These commands allows to user easily initialize a new example of Camel route through VS Code command palette. The commands are grouped under Camel category. To have commands available, you need to have some already existing workspace opened in VS Code. When command is called, the user is asked only to provide a file name and Camel route will be generated (Figure 1).

An animated gif of the initialization of Camel file with JBang.
Figure 1: The initialization of Camel route using XML DSL with JBang.

Run an integration

To run existing Camel integrations, you will need to install Debug Adapter for Apache Camel. This VS Code extension add capabilities to run or run and debug integrations with Camel JBang. You can call commands from VS Code command palette, use context menu available by right-clicking on the integration file, or one-click buttons placed at the top right corner of the opened editor with a valid Camel route.

The run with JBang option supports by default the automatic reloading feature of Camel JBang. This allows to update values of already running integration, and you will see new changes immediately without need of stop and rerun current execution (Figure 2).

An animated gif showing the one-click local run of Camel integration with JBang.
Figure 2: The one-click local run of Camel integration with JBang.

Edit an integration

If you prefer to see a visualization of the Camel route or modifications easily with an UI, then the VS Code extension named Kaoto – No Code and Low Code graphical integration editor is a really nice experience. It accelerates new users and helps experienced developers to quickly build and see their Camel integrations (Figure 3).

A screenshot of the Kaoto graphical editor.
Figure 3: Edit property of Camel component through graphical Kaoto editor.

Getting started with VS Code for Apache Camel

The following 2-minute video shows how to get started with VS Code for Apache Camel.

What's next?

We would be more than happy for your feedback. If you spot bugs or have a request, you can open issues on GitHub or the JIRA project. For more advanced use cases, take a look at the Demo of Red Hat Integration and Apache Camel tooling.

Last updated: November 8, 2023