Featured image for "Improve coss-team colllaboration with Camel K."

This two-part series walks through a simple way to normalize and connect services through Camel K, a part of the Apache Camel project. The scenario in this article addresses a common problem today: Organizations find themselves with a menagerie of different services using different APIs, perhaps because of partnerships or acquisitions.

Apache Camel makes it easy to harmonize and normalize the APIs, and its Camel K extension brings Apache Camel's operations to Kubernetes, allowing containers to expose these endpoints.

In this article, we will focus on the benefits of choosing this framework and provide an overview of our base integration flow using Camel K to normalize a backend API. Part 2 shows you how to implement the integration flow step-by-step. We'll also cover how to simplify data mapping with AtlasMap.

Apache Camel: A framework for all API endpoints

For many reasons, a lot of organizations need to develop new, front-facing APIs to normalize access to their backend services. Legacy systems can still expose XML over REST or SOAP or might require non-HTTP communication. Over time, the organization might also need to integrate new systems, such as from partnerships or acquisitions. An extra layer of APIs provides a consistent interface to the diverse systems that lie beneath (Figure 1).

Figure 1. The API layer normalizes and exposes access to core systems, and extends to acquired and partner systems.
The API layer normalizes and exposes access to core systems, and extends to acquired and partner systems.

When planning a front-facing layer to standardize access, it's essential to adopt a common framework, as when designing a manufacturing production line. The lack of a common framework can slow down the rollout of services and result in a landscape of systems different from one another. The result is simply impractical and a lot harder to maintain.

Nowadays, most services are exposed using the OpenAPI specification and communicate through JSON data structures. Plenty of examples from different languages and frameworks are available online, showing how to construct APIs. How do you pick one out of so many choices?

For starters, your framework should have integration characteristics. More specifically, ensure that the framework excels at least in these essential elements:

  • REST definitions
  • Data transformations
  • Rich connectivity
  • Developer-friendly domain-specific language (DSL)

In all of these requirements, Apache Camel shines. Apache Camel is solid at solving corner cases, thus minimizing the need to seek alternative solutions when confronting complex problems.

About Camel K

The latest evolution of Apache Camel is Camel K, our choice in this article. While Apache Camel implements the integration framework, Camel K lowers the barrier to running integrations in container environments by promoting Camel integrations to first-class citizens in Kubernetes. In addition, Camel K offers a set of key benefits that include:

  • Efficiency: Camel K uses Quarkus as its base runtime. Quarkus has a low memory footprint and offers subsecond boot times and restarts.
  • Developer joy: Camel K provides live coding reloads and automatic dependency resolution.
  • Low-code and templating: Kamelets and KameletBindings are two Camel K constructs that expand its reusability and wider audience consumption.
  • Native connectivity: Camel K provides native integration with cloud services such as Apache Kafka and Knative.
  • Serverless integration: Camel K detects and enables serverless capabilities to run integrations.

I have provided a list of resources at the end of this article to guide you toward further exploration of Camel K.

Camel K implementation overview

This article starts with the goal of defining our base integration flow using Camel K to normalize a backend API. In our example, our backend serves an XML service via HTTP, and we want to expose it as an endpoint compatible with OpenAPI. All the code for the example can be found in a GitHub repository. You can also watch this companion video where I execute the use case described in this article.

We'll go through the following steps to construct our Camel K implementation:

  1. Inspect the service interface for the backend core capability.
  2. Design an OpenAPI definition that simplifies and normalizes access.
  3. Create data mapping definitions for runtime execution.
  4. Define a Camel route that implements the end-to-end flow.

Figure 2. The order and locations of tasks to be completed.
Figure 2: Order and locations of tasks to complete.

Coming up: How to implement the Camel K integration

In the next part of this series, we'll dive into each of the tasks illustrated in Figure 2 in detail. We will put on our developer hats and examine the necessary actions to implement the integration flow, including data mapping with AtlasMap. Jump to Part 2 now.

Learn more about Camel K

See the following resources to learn more about Camel K and Red Hat's support for it:

Last updated: October 20, 2023