Nathan Aw
Nathan Aw

Reputation: 565

Use of Apache Camel in a Microservice Architecture

I observed an increasing trend of people using Apache Camel in a Microservice Architecture. E.g., on Openshift Container Platform.

I struggle very hard to understand why an Enterprise Service Bus, a fundamental monolithic, can be used in a Microservice Architecture.

Perhaps Apache Camel is used for the purpose of Orchestration? But that runs against the spirit of microservices.

Can someone enlighten me on this, please? I can't wrap my head around this.

Upvotes: 2

Views: 7438

Answers (3)

tore gard andersen
tore gard andersen

Reputation: 1

Camel has a java/kotlin DSL for writing flows and orchestration services.

Camel has a set of integration components that makes it to integrate to different endpoint/protocols.

The DSL gives you a standard "language" for writing orchestration flows - using the fluent pattern.

Camel has also a testing framework that make it easy to write flow test and mock endpoints.

Camel support how to handle exception, retry, idempontent consumer(https://camel.apache.org/components/latest/eips/idempotentConsumer-eip.html)

Camel implements a set of enterprise integration patterns, see https://camel.apache.org/components/latest/eips/enterprise-integration-patterns.html

When making many microservices, without grouping the services, it can become a bit messy...

Camel gives you the extra tool that bind all together.

It should not mix this with streaming or reactive programming, Kafka streaming api and so weiter....it is layer over this stuff....

Upvotes: 0

Rajith Attapattu
Rajith Attapattu

Reputation: 464

Apache Camel is not an ESB. Instead, it's a lightweight integration framework with many connectors for databases, message-queues, streaming platforms, and popular APIs. It also has support for close to 50 data formats and supports multiple runtimes including Springboot and support for Quarkus with Camel 3.

Why is it great for Microservices?

  • Springboot support & Quarkus support (can't get any micro than that atm).
  • Every Microservice needs to communicate with other services or the outside world and Camel's integration toolkit with multiple components, data formats make it easy.
  • The REST DSL makes it very easy to put together a REST interface
  • JMS & Kafka components make event-driven Microservices development easy.
  • OpenTracing support enables distributed tracing.
  • Metrics exported via JMX (can use with prometheus jmx exporter) helps instrumenting your camel apps.

Hope this helps.

Upvotes: 5

gusto2
gusto2

Reputation: 12085

I struggle very hard to understand why an Enterprise Service Bus, a fundamental monolithic, can be used in a Microservice Architecture.

ESB has multiple capabilities useful for microservice architecture. It enables:

  • message mediation and transformation, see Enterprise Integration Patterns
  • cross-service policy enforcement (e.g. message level security, authorization, ..)
  • decouplig of the service endpoint from its implementation (service versioning)
  • provides commodity services such as messaging, event handling, monitoring, exception hadling, ..
  • mitigating point-to-point communication
  • .. some more..

Indeed the ESB usually runs as a separate application (or container in your case) and having implemented all the capabilities, it is not always the most lightweight application (comparing to simple single-purpose microservices). If implemented properly, ESB should have minimal impact on the response latency or infrastructure load.

Providing commodity services and cross-service capabilities IMHO you can consider ESB not as a separate service, but part of infrastructure services usable by the microservice implementaations.

Perhaps Apache Camel is used for the purpose of Orchestration? But that runs against the spirit of microservices.

Apache Camel is a framework, it can be used inside an applications, standalone or as well there are ESB products built on top of Apache Camel (RedHat Fuse ESB, Talend ESB, Apache ServiceMix, ..).

Upvotes: 2

Related Questions