---
title: "Apache Camelとは？ルートとEIPの考え方、4.24.0で動かす手順とMuleSoftとの選び分け【2026年12月】"
url: "https://www.issoh.co.jp/tech/details/20872/"
published: 2026-12-05
updated: 2026-12-05
categories: ["自動化"]
publisher: "株式会社一創"
---

# Apache Camelとは？ルートとEIPの考え方、4.24.0で動かす手順とMuleSoftとの選び分け【2026年12月】

Apache Camelは、システム同士をつなぐ処理を「ルート」として書くオープンソースの統合フレームワークです。ファイル・HTTP・メッセージキューなどの接続先をURIで指定し、分岐・分割・集約といった処理を、エンタープライズ統合パターン（EIP）の名前のままJavaやYAMLで組み立てます。動かすだけなら、Java 21とMavenを用意し、camel-mainの依存を足してRouteBuilderを1つ書けば数分で済みます。版番号とサポート期限は2026年12月5日時点の公式サイトで確認し、コードは同じ日にCamel 4.24.0で実行しました。本番に入れるなら、最新の4.24.0ではなくLTSの4.22系を選び、timerを使うルートには`includeMetadata=true`を付けてください。

## Apache Camelの位置づけ：EIPをルートで書く統合フレームワーク

### ルート・エンドポイント・EIPの3つの部品と役割

公式サイトの[What is Camel?](https://camel.apache.org/what-is-camel.html)は、Camelを「既知のエンタープライズ統合パターンにもとづく、汎用のオープンソース統合フレームワーク」と説明しています。ルーティングと変換の規則は、Java・XML・YAMLのいずれかのDSL（専用の書き方）で書きます。

Camelのコードは、ほぼ3つの部品でできています。データの入口と出口になるエンドポイント（`timer:`・`file:`・`kafka:`などのURI）、入口から出口までの処理の並びであるルート、ルートの途中に置く分岐や分割などの処理（EIP）です。接続先が変わってもURIを書き換えるだけで、ルートの組み立て方は同じです。

### EIPの分類と、実務でまず使う5つのパターン

EIPは、Gregor Hohpe氏とBobby Woolf氏の書籍『[Enterprise Integration Patterns](https://www.enterpriseintegrationpatterns.com/)』で名前を付けられたシステム連携の定石です。Camelの[EIPの一覧](https://camel.apache.org/components/next/eips/enterprise-integration-patterns.html)は、書籍のパターンの大部分に対応していると書き、Message Routing、Splitting and Aggregation、Error Handling and Resilienceなどの分類で並べています。

| パターン                 | Camelでの書き方                | 使う場面           |
| -------------------- | ------------------------- | -------------- |
| Content-Based Router | choice / when / otherwise | 中身で送り先を変える     |
| Splitter             | split                     | CSVの1行ずつ処理する   |
| Aggregator           | aggregate                 | 複数の応答を1つにまとめる  |
| Dead Letter Channel  | deadLetterChannel         | 失敗したメッセージを退避する |
| Wire Tap             | wireTap                   | 本線を止めずに写しを送る   |

実務で最初に覚えるのは、分岐のContent-Based Routerと、失敗の退避先を決めるDead Letter Channelの2つです。連携の処理は「どこへ送るか」と「失敗したらどうするか」で設計の大半が決まるからです。リアルタイム連携とバッチ集約のどちらで組むかは、[EAIとETLの違いと使い分け](https://www.issoh.co.jp/column/details/18979/)で先に決めておくと、ルートの粒度がぶれません。

### 4.24.0とLTSの期限：本番で選ぶ版の決め方

[公式のリリース一覧](https://camel.apache.org/releases/)では、4.24.0が2026年12月2日に公開されています。同じ一覧で「LTS」と付いているのは4.22系と4.18系で、2026年11月に4.22.3と4.18.6が出ました。[ダウンロードページ](https://camel.apache.org/download/)のサポート表によると、4.22 LTSのサポート終了は2027年8月、4.18 LTSは2027年2月です。4.24.0にはLTSの表記もサポート終了日もありません。

2026年8月11日 4.22.0 LTS 公開 2026年12月2日 4.24.0 公開 2027年2月 4.18 LTS 終了 2027年8月 4.22 LTS 終了 4.24.0 はリリース一覧で LTS の表記が無い（サポート終了日の記載なし） 

Camel 4.18 LTS・4.22 LTS・4.24.0 の公開とサポート終了の時期

Javaの対応も版で分かれます。同じサポート表では、4.24.0の対応は21と25で、Java 17は外れました。4.22.3は17・21・25、4.18.6は17と21です。Java 17のまま動かしている既存システムに入れるなら4.22 LTS、新規でJava 21以上にそろえられるなら4.22 LTSを本番に、4.24.0は検証用に、と分けるのが安全です。ライセンスは、Maven Centralに置かれた[camel-parentのPOM](https://repo1.maven.org/maven2/org/apache/camel/camel-parent/4.24.0/camel-parent-4.24.0.pom)にApache-2.0と書かれています。

## Camel 4.24.0をcamel-mainで動かす手順と実行結果

### 検証環境：Ubuntu 24.04・OpenJDK 21・Camel 4.24.0

ここから先のコードは、2026年12月5日にクラウドの作業用コンテナで実際にビルドして実行しました。検証環境は次のとおりです。

| 項目    | 版                         |
| ----- | ------------------------- |
| OS    | Ubuntu 24.04.5 LTS        |
| Java  | OpenJDK 21.0.13.1         |
| ビルド   | Apache Maven 3.9.11       |
| Camel | 4.24.0（camel-bom で版をそろえる） |
| ログ出力  | slf4j-simple 2.0.17       |

Spring BootもQuarkusも使わず、Camel単体で起動する[camel-main](https://camel.apache.org/components/next/others/main.html)を使います。camel-mainはCamelをスタンドアロンのアプリとして動かすモジュールで、`camel.main.*`の設定で起動と停止を制御できます。

### pom.xmlにcamel-bomとcamel-mainを入れる

版の食い違いを防ぐため、`camel-bom`を`dependencyManagement`で読み込み、個々の依存には版を書きません。使うコンポーネント（ここではtimerとlog）を1つずつ足すのがCamel 4系の書き方です。

```
<project xmlns="http://maven.apache.org/POM/4.0.0">
  <modelVersion>4.0.0</modelVersion>
  <groupId>com.example</groupId>
  <artifactId>camel-demo</artifactId>
  <version>1.0</version>
  <properties>
    <maven.compiler.release>21</maven.compiler.release>
    <camel.version>4.24.0</camel.version>
  </properties>
  <dependencyManagement>
    <dependencies>
      <dependency>
        <groupId>org.apache.camel</groupId>
        <artifactId>camel-bom</artifactId>
        <version>${camel.version}</version>
        <type>pom</type>
        <scope>import</scope>
      </dependency>
    </dependencies>
  </dependencyManagement>
  <dependencies>
    <dependency><groupId>org.apache.camel</groupId><artifactId>camel-main</artifactId></dependency>
    <dependency><groupId>org.apache.camel</groupId><artifactId>camel-timer</artifactId></dependency>
    <dependency><groupId>org.apache.camel</groupId><artifactId>camel-log</artifactId></dependency>
    <dependency><groupId>org.slf4j</groupId><artifactId>slf4j-simple</artifactId><version>2.0.17</version></dependency>
  </dependencies>
  <build>
    <plugins>
      <plugin>
        <groupId>org.codehaus.mojo</groupId>
        <artifactId>exec-maven-plugin</artifactId>
        <version>3.5.1</version>
        <configuration><mainClass>com.example.App</mainClass></configuration>
      </plugin>
    </plugins>
  </build>
</project>
```

コンポーネントを足し忘れると、起動時に`timer`のURIを解決できずに止まります。Camelのコンポーネントは機能ごとに別のjarに分かれているので、ルートで使うURIの接頭辞と依存を1対1で見比べてください。

### ルートを書いて実行する：choiceで分岐するorder-router

次のコードは、timerが1秒ごとに3回メッセージを作り、発火回数を本文に入れて、2回目だけ別の枝へ送るルートです。分岐は[Choice EIP](https://camel.apache.org/components/next/eips/choice-eip.html)（Content-Based Router）で書いています。5秒たつと`withDurationMaxSeconds(5)`でJVMごと止まります。

```
package com.example;

import org.apache.camel.builder.RouteBuilder;
import org.apache.camel.main.Main;

public class App {
    public static void main(String[] args) throws Exception {
        Main main = new Main();
        main.configure().addRoutesBuilder(new OrderRoute());
        // 5秒で停止する（動作確認用）
        main.configure().withDurationMaxSeconds(5);
        main.run(args);
    }

    static class OrderRoute extends RouteBuilder {
        @Override
        public void configure() {
            from("timer:orders?period=1000&repeatCount=3&includeMetadata=true")
                .routeId("order-router")
                .setBody(simple("${exchangeProperty.CamelTimerCounter}"))
                .choice()
                    .when(simple("${body} == 2"))
                        .log("express: 注文 ${body} を至急キューへ")
                    .otherwise()
                        .log("standard: 注文 ${body} を通常キューへ")
                .end();
        }
    }
}
```

ルート order-router timer:orders 1秒ごと・3回 setBody 発火回数を本文へ choice 本文の値で分岐 when 本文が2 express のログ otherwise standard のログ 

検証したルート order-router の流れ（timer → setBody → choice → log）

実行はMavenのexecプラグインで行いました。ログの日本語が文字化けしないよう、標準出力の文字コードをUTF-8に指定しています。

```
export MAVEN_OPTS="-Dstdout.encoding=UTF-8 -Dstderr.encoding=UTF-8"
mvn -B compile exec:java
```

実行すると、次のログが出ました（Mavenのビルドの行を除いて、Camelの行だけを抜き出しています）。

```
[com.example.App.main()] INFO org.apache.camel.main.MainSupport - Apache Camel (Main) 4.24.0 is starting
[com.example.App.main()] INFO org.apache.camel.impl.engine.AbstractCamelContext - Apache Camel 4.24.0 (camel-1) is starting
[com.example.App.main()] INFO org.apache.camel.impl.engine.AbstractCamelContext - Routes startup (total:1)
[com.example.App.main()] INFO org.apache.camel.impl.engine.AbstractCamelContext -     Started order-router (timer://orders)
[com.example.App.main()] INFO org.apache.camel.impl.engine.AbstractCamelContext - Apache Camel 4.24.0 (camel-1) started in 8ms (build:0ms init:0ms start:8ms boot:221ms)
[com.example.App.main()] INFO org.apache.camel.main.MainSupport - Waiting until complete: Duration max 5 seconds
[Camel (camel-1) thread #2 - timer://orders] INFO order-router - standard: 注文 1 を通常キューへ
[Camel (camel-1) thread #2 - timer://orders] INFO order-router - express: 注文 2 を至急キューへ
[Camel (camel-1) thread #2 - timer://orders] INFO order-router - standard: 注文 3 を通常キューへ
[com.example.App.main()] INFO org.apache.camel.main.MainSupport - Duration max seconds triggering shutdown of the JVM
[com.example.App.main()] INFO org.apache.camel.impl.engine.AbstractCamelContext - Apache Camel 4.24.0 (camel-1) is shutting down (timeout:45s)
[com.example.App.main()] INFO org.apache.camel.impl.engine.AbstractCamelContext - Routes stopped (total:1)
[com.example.App.main()] INFO org.apache.camel.impl.engine.AbstractCamelContext -     Stopped order-router (timer://orders)
[com.example.App.main()] INFO org.apache.camel.impl.engine.AbstractCamelContext - Apache Camel 4.24.0 (camel-1) shutdown in 9ms (uptime:5s)
[com.example.App.main()] INFO org.apache.camel.main.MainSupport - Apache Camel (Main) 4.24.0 shutdown
```

起動から停止まで、ルートは1本（`Routes startup (total:1)`）で、2回目の発火だけが`express`の枝に入っています。CamelContextの起動は8ミリ秒、Mainとしての起動は221ミリ秒でした。

## Camel 4系で詰まる箇所：timerの発火回数とコンポーネントの分割

### includeMetadataを付けないと発火回数が空になる

最初に書いたルートでは、URIに`includeMetadata=true`を付けていませんでした。同じコードからこのオプションだけを外して実行すると、ログは次のとおりです。

```
[Camel (camel-1) thread #2 - timer://orders] INFO order-router - standard: 注文  を通常キューへ
[Camel (camel-1) thread #2 - timer://orders] INFO order-router - standard: 注文  を通常キューへ
[Camel (camel-1) thread #2 - timer://orders] INFO order-router - standard: 注文  を通常キューへ
```

発火回数が空のまま3回とも`otherwise`へ流れ、エラーにもなりません。[timerコンポーネントのドキュメント](https://camel.apache.org/components/latest/timer-component.html)では、`includeMetadata`の既定値は`false`で、発火時刻・timer名・発火回数などをExchangeに入れるかどうかの設定だと説明されています。発火回数は`Exchange.TIMER_COUNTER`（1から始まるLong）というプロパティです。

Camel 2系や3系の解説記事をもとにtimerのルートを書くと、ここで分岐が効かないまま本番に出かねません。テストでは、分岐したい値が実際に入っているかをログで1回は確かめてください。

### Spring Boot・Quarkusでは依存の名前と版の決め方が変わる

アプリの土台をSpring BootかQuarkusにする場合、依存の書き方が変わります。公式の説明をもとに違いをまとめます（この節の構成は、この記事では実行していません）。

| 土台             | 入れる依存               | 版の決め方              |
| -------------- | ------------------- | ------------------ |
| camel-main（単体） | camel-main＋各コンポーネント | camel-bom          |
| Spring Boot    | 基本starter＋各starter  | Camelと同じ版のBOM      |
| Quarkus        | Camel Quarkusの各拡張   | Camel Quarkusの版に従う |

[Camel Spring Boot](https://camel.apache.org/camel-spring-boot/next/)は、`@Component`を付けたRouteBuilderを起動時に見つけてCamelContextへ登録します。上のOrderRouteを独立したクラスに移して`@Component`を付ければ、`configure()`の中身は書き換えずに移せる作りです。基本の依存には`camel-spring-boot-starter`を使い、各starterを追加します。`camel-spring-boot-bom`の版はCamelとそろえてください。Spring Boot自体の最小構成は[Spring Boot 4.1系の最小Web APIの作り方](https://www.issoh.co.jp/tech/details/17478/)にまとめています。

[Camel Quarkusの互換表](https://camel.apache.org/camel-quarkus/next/)では、本番向けの3.40.xがCamel 4.22.3・Quarkus 3.40.2の組み合わせです。Camel 4.24.0・Quarkus 4.0.1の組み合わせは開発版（Next）の扱いで、公式も本番では使わないよう注意しています。Quarkus 4.0側の変更点は[Quarkus 4.0の変更点とREST APIを動かす手順](https://www.issoh.co.jp/tech/details/20553/)で検証しました。

## MuleSoft・iPaaSとApache Camelを選び分ける条件

### MuleSoftとの違い：ライセンス費用と運用を誰が持つか

MuleSoft Anypoint Platformは、API設計・実行環境・監視の画面までをSalesforceが提供する商用製品です。料金と構成は[MuleSoftのMule Credits課金とAPI主導の構成](https://www.issoh.co.jp/tech/details/19912/)で整理しています。Camelはライセンス費用がかからない代わりに、実行環境・監視・APIの公開の画面は自分たちで用意します。

差が出るのは、ライセンス費用と、運用を担う人の手当ての2点です。Javaを書けるエンジニアが社内か外注先にいて、連携の本数が増えてもライセンス費用を増やしたくないならCamelが合います。API管理の画面・利用者ごとの認証・監視の仕組みを最初から全部そろえて、運用は製品のサポートに任せたいならMuleSoftが候補になります。国内の連携製品と比べるなら、[DataSpiderのHTTPトリガーとアダプタ](https://www.issoh.co.jp/tech/details/17174/)や[ASTERIA Warpのエディション別料金](https://www.issoh.co.jp/tech/details/19910/)も比較の相手です。

### Camelを採用する条件と、見送るべき場面

Camelを採用するのは、次の条件が2つ以上当てはまる場合です。連携先が社内の基幹システム・ファイル・メッセージキューなど5つ以上ある。連携の処理をGitで管理し、テストとレビューを通してから本番に出したい。Spring BootかQuarkusのアプリがすでにあり、その中に連携を組み込みたい。Kafkaとつなぐ場合の基礎は[RabbitMQとKafkaの違いと使い分け](https://www.issoh.co.jp/tech/details/15305/)と[Kafka Connectの仕組み](https://www.issoh.co.jp/tech/details/16086/)で確かめられます。

見送るのは、Javaのコードを保守できる人がいない会社と、つなぐ先がkintone・Slack・Salesforceなどの有名なSaaSだけの会社です。前者はルートの不具合を直せずに止まり、後者は画面で組める[iPaaSのAPI・RPA・ETLとの違いと料金の数え方](https://www.issoh.co.jp/column/details/13373/)を読んでからiPaaSを選ぶほうが早く動きます。連携の数が2〜3本で、今後も増えないなら、Camelを入れずに[API開発・システム連携](https://www.issoh.co.jp/service/system/api/)として個別のAPI呼び出しを書くほうが、依存も運用の手間も小さく済みます。

## よくある質問

### Apache Camelは無料で商用利用できますか？

Camel 4.24.0のPOMに書かれたライセンスはApache-2.0で、ライセンス費用はかからず商用のシステムにも組み込めます。Apache-2.0は、配布するときに著作権表示とライセンス文を添える条件があります。社内で動かすだけなら配布に当たりませんが、Camelを組み込んだ製品を顧客に納品する場合は、ライセンス文の同梱を納品物の確認項目に入れてください。有償のサポートが必要なら、Camelを含む商用ディストリビューションを提供する企業との契約を別に検討します。

### Camel 3系から4系へ上げるときに何が変わりますか？

Camel 4系はJava 17以上が前提で、4.24.0ではJava 21以上が必要です。Spring Bootを使っている場合は、Camelの版とCamel Spring Bootの版を同じ番号にそろえます。この記事の検証で見たとおり、timerの発火回数のようにオプションの既定値で動きが変わる箇所は、エラーにならずに値が空になります。上げたあとは、分岐や集約の条件に使っている値がログに出ているかを、ルートごとに確かめてください。

## 関連記事

- [MuleSoftとは？Mule Credits課金とAPI主導の構成・実装手順](https://www.issoh.co.jp/tech/details/19912/)：商用の統合基盤と比べるときの相手
- [EAIとETLの違い｜リアルタイム連携とバッチ集約の使い分けと併用構成](https://www.issoh.co.jp/column/details/18979/)：Camelで組む連携の方式を決める前提
- [Quarkusとは？Java 21必須の4.0の変更点とREST APIを動かす手順【4.0.1で検証】](https://www.issoh.co.jp/tech/details/20553/)：Camel Quarkusの土台になるフレームワーク
- [Spring Bootとは｜4.1系の依存名の変更と最小Web APIの作り方](https://www.issoh.co.jp/tech/details/17478/)：Camel Spring Bootの土台になるフレームワーク
- [iPaaSとは？API・RPA・ETLとの違いと料金の数え方【2026年11月】](https://www.issoh.co.jp/column/details/13373/)：コードを書かずに連携する選択肢

---

出典: [Apache Camelとは？ルートとEIPの考え方、4.24.0で動かす手順とMuleSoftとの選び分け【2026年12月】](<https://www.issoh.co.jp/tech/details/20872/>)（株式会社一創）
