When To Use Apache Camel vs. Apache Kafka?

Should I use Apache Camel or Apache Kafka for my next integration project? The question is very valid and comes up regularly. This blog post explores both open-source frameworks and explains the difference between application integration and event streaming. The comparison discusses when to use Kafka or Camel when to combine them, and when not to use them at all. A decision tree shows how you can quickly qualify one for the other.

The History of Application Integration and Event Streaming

My personal history and experience in application integration and event streaming are the following. It shows my background and how I see the integration and data streaming markets.

REST Services With Apache Camel

Microservices are becoming a very popular architectural style for developing greenfield applications and also for brownfield solutions. People are moving away from the monolith solutions due to added advantages like faster development and go-to-market, increased adoption of containerization and small teams, and a lighter codebase. 

You can use either Spring Boot, Quarkus, or Lagom frameworks to develop the REST services. I would like to show how we can use Apache Camel, a leading opensource integration framework, to write REST services easier and quicker using the REST domain-specific language (DSL).

Coding Your First Camel Route

Enterprises consists of N number of systems each supporting different protocols and transports, thereby making enterprise integrations quite complex. 

Apache Camel is an open source framework that provides an implementation of various enterprise integration patterns. Camel makes integration easier by providing support for a large variety of transports, data formats, and protocols. There are 100+ components provided for messaging queues, APIs, databases, Kafka, cloud integrations, etc.

Contract-First Development — the Event-Driven Way!

Introduction

Contract first application development is not limited to synchronized RESTFul API calls. With the adoption of event-driven architecture, more developers are demanding a way to set up contracts between these asynchronous event publishers and consumers. Sharing what data format that each subscriber is consuming, what data format is used from the event publisher, in a way OpenAPI standards is going to be very helpful.

But in the asynchronous world, it is ever more complex, not only do you need to be caring about the data schema, there are different protocols, serializing, deserializing mechanisms, and various support libraries. In fact, there are talks on AsyncAPI. But I am going to show you that what can be done today,  is to use ONE of the most commonly used solutions in building EDA, “Kafka”. And show how to do Contract First Application Development using Camel + Apicurio Registry. 

End2End Testing With TestContainers…and a Lot of Patience

This time I would like to show my experience creating an End2End test for a Camel integration application that connects these layers:

  • Apache Kafka
  • Apache ActiveMQ Artemis
  • PostgreSQL
  • Localstack ( AWS similar )
  • Red Hat Ingress upload service
  • Minio ( AWS similar )
  • KIE server ( rules engine )
  • Apache Camel rest endpoints. (<- the app)
apache camel integration


Develop Camel-Quarkus Applications Using Red Hat

Red Hat Open Shift

Red Hat Open Shift offers a consistent hybrid-cloud foundation for building and scaling containerized applications. Open Shift provides an enterprise-grade, container-based platform with no vendor lock-in. Red Hat was one of the first companies to work with Google on Kubernetes, even before launch, and has become the second leading contributor to the Kubernetes upstream project. Open Shift also provides a common development platform no matter what infrastructure we use to host the application.

Quarkus

Quarkus provides a container-first approach to building Java applications. This approach makes it much easier to build microservices-based applications written in Java as well as enabling those applications to invoke functions running on serverless computing frameworks. For this reason, Quarkus applications have small memory footprints and fast start-up times.

Why Camel K?

1. Dev Mode

 To run a camel spring boot or camel main application in Kubernetes, it requires a developer to build the docker or s2i images, create Kubernetes resources and then apply the resources to a running cluster which is very time-consuming. Camel K solves this problem and saves development time with the dev mode. Simply adding a --dev flag while running code allows the developer to deploy instantly to Kubernetes and also make any changes to the running pod whenever the source file is updated.

2. Dependency Resolution

 We know that camel supports multiple DSL such as Java or Groovy and Camel K supports it as well. What is new in Camel K is that the automatic dependencies management feature. The developer need not worry about packaging a deployable artifact or the maven or Gradle dependencies of various components. It automatically resolves the necessary dependencies from a source file during deployment. And also only one source file is enough to run integration in a pod.

A Simple Introduction to Apache Camel

A "Stable, Consistent Architecture" is a myth. It can never be achieved. Over the years, each of us has come to accept this fact, and with a microservices architecture, it is a lot easier to live with this fact. But, that does pose a lot of other issues that we need to look at.

An important hurdle in this journey is that of application integration. A core tenet of the microservice architecture is that any interaction or integration between systems should be based on globally accepted standards rather than a mutually accepted protocol. If we build a system based on a protocol that is based on a simple mutual agreement between two developers, it can never work beyond those two developers. To enable a generic plug and play interface, the communication has to be based on globally accepted standards.

How to Read/Write Files From Google Drive Using Camel-Quarkus

Introduction

The Google Drive component provides access to the Google Drive file storage service via the Google Drive Web APIs.

Google Drive uses the OAuth 2.0 protocol for authenticating a Google account and authorizing access to user data. Before you can use this component, you will need to create an account and generate OAuth credentials. Credentials comprise of a clientId, clientSecret, and a refreshToken. A handy resource for generating a long-lived refreshToken is the OAuth playground.

Perform Remote Caches With JBoss Fuse and Red Hat Data Grid

Nowadays, the reality of companies demands even more integration between different technologies, working together, changing, and processing data. In this ecosystem, the use of an integration platform is essential. Still, the use of an in-memory database is necessary for a significant gain in information processing performance. In this article, we will demonstrate the use of the JBoss Fuse integration platform, in conjunction with the In-memory database named  Red Hat Data Grid.

JBoss Fuse is an integration platform based on the framework Apache Camel. It focuses on mediation, transformation, and data routing among many applications, services, and devices. 

Creating Camel 3 CDI Microservices

As many people already know, Apache Camel is an open-source project that makes easy implement integration projects, in this post I want to go through some libraries that allow creating microservices within a camel ecosystem (Pure Apache Camel 3 microservices).

In order to create microservices with camel we can combine some camel modules such: