Convert Figma logo to code with AI

apache logocamel

Apache Camel is an open source integration framework that empowers you to quickly and easily integrate various systems consuming or producing data.

6,199
5,102
6,199
26

Top Related Projects

Spring Integration provides an extension of the Spring programming model to support the well-known Enterprise Integration Patterns (EIP)

6,158

Apache NiFi

33,273

Apache Kafka - A distributed event streaming platform

26,162

Apache Flink

Apache Flume is a distributed, reliable, and available service for efficiently collecting, aggregating, and moving large amounts of log-like data

Quick Overview

Apache Camel is a versatile open-source integration framework based on known Enterprise Integration Patterns. It empowers you to define routing and mediation rules in a variety of domain-specific languages, including a Java-based Fluent API, Spring or Blueprint XML Configuration files, and a Scala DSL. Camel can be used as a routing and mediation engine for various scenarios, from small microservices to large enterprise systems.

Pros

  • Extensive component library with support for numerous protocols and data formats
  • Flexible and extensible architecture allowing easy integration with various systems
  • Strong community support and regular updates
  • Comprehensive documentation and examples

Cons

  • Steep learning curve for beginners
  • Can be overkill for simple integration tasks
  • Performance overhead in certain scenarios
  • Configuration complexity in large-scale deployments

Code Examples

  1. Simple route definition:
from("file:input")
    .to("file:output");

This code defines a route that moves files from an input directory to an output directory.

  1. Content-based routing:
from("direct:start")
    .choice()
        .when(simple("${body} contains 'urgent'"))
            .to("direct:priority")
        .otherwise()
            .to("direct:normal");

This example demonstrates content-based routing, where messages containing "urgent" are sent to a priority endpoint, while others go to a normal endpoint.

  1. Error handling:
errorHandler(deadLetterChannel("jms:queue:dead")
    .maximumRedeliveries(3)
    .redeliveryDelay(1000)
    .backOffMultiplier(2)
    .useExponentialBackOff());

from("file:input")
    .to("jms:queue:output");

This code sets up an error handler with a dead letter channel, configuring redelivery attempts and exponential backoff.

Getting Started

To get started with Apache Camel, follow these steps:

  1. Add the Camel dependency to your project's pom.xml:
<dependency>
    <groupId>org.apache.camel</groupId>
    <artifactId>camel-core</artifactId>
    <version>3.18.0</version>
</dependency>
  1. Create a simple route in your Java code:
import org.apache.camel.builder.RouteBuilder;
import org.apache.camel.impl.DefaultCamelContext;

public class MyRouteBuilder extends RouteBuilder {
    @Override
    public void configure() throws Exception {
        from("file:input")
            .to("file:output");
    }

    public static void main(String[] args) throws Exception {
        DefaultCamelContext context = new DefaultCamelContext();
        context.addRoutes(new MyRouteBuilder());
        context.start();
        Thread.sleep(10000);
        context.stop();
    }
}

This example sets up a simple file transfer route and runs it for 10 seconds before stopping.

Competitor Comparisons

Spring Integration provides an extension of the Spring programming model to support the well-known Enterprise Integration Patterns (EIP)

Pros of Spring Integration

  • Tighter integration with Spring ecosystem and easier setup for Spring-based applications
  • More focused on enterprise integration patterns and message-driven architectures
  • Simpler configuration using annotations and Java DSL

Cons of Spring Integration

  • Less extensive component library compared to Camel
  • More limited support for non-JVM languages and platforms
  • Steeper learning curve for developers not familiar with Spring concepts

Code Comparison

Spring Integration:

@Bean
public IntegrationFlow fileFlow() {
    return IntegrationFlows.from(Files.inboundAdapter(new File("/input")))
            .filter(File.class, p -> p.getName().endsWith(".txt"))
            .transform(Files.toStringTransformer())
            .handle(System.out::println)
            .get();
}

Camel:

from("file:input?include=.*\\.txt")
    .convertBodyTo(String.class)
    .to("stream:out");

Both frameworks provide ways to create integration flows, but Spring Integration leverages Spring's dependency injection and configuration model, while Camel uses a more fluent DSL approach. Spring Integration's code tends to be more verbose but offers tighter Spring ecosystem integration, whereas Camel's syntax is more concise and focuses on route definitions.

6,158

Apache NiFi

Pros of NiFi

  • User-friendly web-based interface for designing and managing data flows
  • Built-in data provenance and lineage tracking
  • Supports a wide range of data formats and protocols out-of-the-box

Cons of NiFi

  • Steeper learning curve for complex data flows
  • Higher resource consumption, especially for large-scale deployments
  • Less flexibility for custom integrations compared to Camel

Code Comparison

NiFi uses a visual flow-based programming model, while Camel uses a more traditional coding approach. Here's a simple example of each:

NiFi (flow configuration in XML):

<processor>
  <name>GetFile</name>
  <class>org.apache.nifi.processors.standard.GetFile</class>
  <property name="Input Directory">/path/to/input</property>
</processor>

Camel (Java DSL):

from("file:///path/to/input")
  .to("file:///path/to/output");

Both Apache NiFi and Apache Camel are powerful integration frameworks, but they cater to different use cases and preferences. NiFi excels in visual data flow management and tracking, while Camel offers more flexibility and lightweight integration options. The choice between them depends on specific project requirements and team expertise.

33,273

Apache Kafka - A distributed event streaming platform

Pros of Kafka

  • Higher throughput and scalability for large-scale data streaming
  • Better suited for real-time event processing and analytics
  • More robust fault-tolerance and data replication mechanisms

Cons of Kafka

  • Steeper learning curve and more complex setup compared to Camel
  • Less flexibility in terms of supported protocols and data formats
  • Requires more infrastructure and resources to operate effectively

Code Comparison

Kafka producer example:

Properties props = new Properties();
props.put("bootstrap.servers", "localhost:9092");
props.put("key.serializer", "org.apache.kafka.common.serialization.StringSerializer");
props.put("value.serializer", "org.apache.kafka.common.serialization.StringSerializer");
Producer<String, String> producer = new KafkaProducer<>(props);

Camel route example:

from("file:data/inbox")
    .choice()
        .when(xpath("/person/city = 'London'"))
            .to("file:data/outbox/uk")
        .otherwise()
            .to("file:data/outbox/others");

Kafka focuses on high-throughput messaging, while Camel provides a more versatile integration framework. Kafka's code emphasizes configuration and producer setup, whereas Camel's code showcases its routing capabilities and domain-specific language for integration flows.

26,162

Apache Flink

Pros of Flink

  • Designed for large-scale data processing with low latency and high throughput
  • Supports both batch and stream processing in a unified framework
  • Offers advanced features like exactly-once processing semantics and stateful computations

Cons of Flink

  • Steeper learning curve due to its complex architecture and concepts
  • Requires more resources and configuration for optimal performance
  • Less extensive integration ecosystem compared to Camel

Code Comparison

Flink (Java):

DataStream<String> stream = env.addSource(new FlinkKafkaConsumer<>("topic", new SimpleStringSchema(), properties));
stream.map(s -> s.toUpperCase())
      .filter(s -> s.startsWith("A"))
      .addSink(new FlinkKafkaProducer<>("output-topic", new SimpleStringSchema(), properties));

Camel (Java):

from("kafka:input-topic")
    .transform().simple("${body.toUpperCase()}")
    .filter().simple("${body} startsWith 'A'")
    .to("kafka:output-topic");

Summary

Flink excels in large-scale data processing scenarios, offering advanced streaming capabilities. Camel, while less specialized for big data, provides a more extensive integration framework with a gentler learning curve. The code comparison illustrates Flink's more verbose but powerful API, contrasted with Camel's concise and intuitive route definitions.

Apache Flume is a distributed, reliable, and available service for efficiently collecting, aggregating, and moving large amounts of log-like data

Pros of Flume

  • Specialized for log data collection and aggregation
  • Simpler architecture for specific log-focused use cases
  • Lower learning curve for basic log ingestion tasks

Cons of Flume

  • Less versatile compared to Camel's wide range of integration options
  • Smaller community and ecosystem
  • Limited to Java, while Camel supports multiple languages

Code Comparison

Flume configuration example:

agent.sources = s1
agent.channels = c1
agent.sinks = k1

agent.sources.s1.type = netcat
agent.sources.s1.bind = localhost
agent.sources.s1.port = 44444

Camel route example:

from("file:data/inbox")
  .choice()
    .when(xpath("/person/city = 'London'"))
      .to("file:data/outbox/uk")
    .otherwise()
      .to("file:data/outbox/others");

Flume is more focused on configuring sources, channels, and sinks for log data, while Camel provides a more flexible routing system for various integration scenarios. Camel's DSL allows for more complex data processing and routing logic, whereas Flume's configuration is typically simpler but more limited in scope.

Convert Figma logo designs to code with AI

Visual Copilot

Introducing Visual Copilot: A new AI model to turn Figma designs to high quality code using your components.

Try Visual Copilot

README

Apache Camel

Maven Central Javadocs Stack Overflow Chat Twitter

Apache Camel is an open source integration framework with 350+ connectors for databases, APIs, message brokers, and cloud services. Write routes in Java, YAML, or XML. Run on Spring Boot, Quarkus, or standalone with the Camel CLI. In production since 2007 — used by thousands of companies worldwide. Apache License 2.0.

What is Apache Camel? | Getting Started | Components | Tooling

Get started in seconds

camel init hello.yaml
camel run hello.yaml

Or add to your existing Spring Boot project:

<dependency>
    <groupId>org.apache.camel.springboot</groupId>
    <artifactId>camel-spring-boot-starter</artifactId>
</dependency>

Write it your way

The same route in YAML, Java, or XML — pick what fits your team:

YAML:

- route:
    from:
      uri: kafka:incoming-orders
      steps:
        - unmarshal:
            json: {}
        - to:
            uri: sql:INSERT INTO orders(id, data) VALUES(:#${header.id}, :#${body})

Java:

from("kafka:incoming-orders")
    .unmarshal().json()
    .to("sql:INSERT INTO orders(id, data) VALUES(:#${header.id}, :#${body})");

Runtimes

RuntimeWhat it does
Camel Spring BootCamel on Spring Boot with starters for 350+ connectors
Camel QuarkusCloud-native Camel with fast startup, low memory, native compilation
Camel CLIRun, develop, test, and trace routes from the command line

Other runtimes: Camel K (Kubernetes), Camel Karaf (OSGi), Camel Kafka Connector (Kafka Connect)

Components

350+ connectors for connecting to anything — Kafka, REST, JDBC, AWS, Azure, GCP, Salesforce, and more:

AI integration

Apache Camel provides an MCP server (Model Context Protocol) for AI coding assistants — Claude Code, GitHub Copilot, Cursor, and Gemini CLI get full Camel catalog context. Camel also includes components for LangChain4j and OpenAI, and supports the A2A agent-to-agent protocol for connecting AI agents to enterprise systems.

Visual designers

  • Kaoto — open source visual designer for Camel routes, drag-and-drop, no code required
  • Karavan — visual designer for Camel integrations in VS Code and standalone

Examples

Contributing

We welcome all kinds of contributions:

https://github.com/apache/camel/blob/main/CONTRIBUTING.md

Community

Licensing

Apache License 2.0 — see LICENSE.txt.