Fuse 7 アプリケーションの Red Hat build of Apache Camel for Quarkus への移行


Red Hat build of Apache Camel 4.10

Fuse 7 アプリケーションの Red Hat build of Apache Camel for Quarkus への移行

概要

「Fuse 7 アプリケーションの Red Hat build of Apache Camel for Quarkus への移行」では、Red Hat Fuse 7 から Red Hat build of Apache Camel for Quarkus への移行に関する情報を紹介します。

はじめに

Red Hat build of Apache Camel ドキュメントに関するフィードバック

エラーを報告したり、ドキュメントの改善を提案したりするには、Red Hat Jira アカウントにログインし、課題を送信してください。Red Hat Jira アカウントをお持ちでない場合は、アカウントを作成するように求められます。

手順

  1. 次のリンクをクリックして チケットを作成 します。
  2. Summary に課題の簡単な説明を入力します。
  3. Description に課題や機能拡張の詳細な説明を入力します。問題があるドキュメントのセクションへの URL も記載してください。
  4. Submit をクリックすると、課題が作成され、適切なドキュメントチームに転送されます。

第1章 Fuse 7 アプリケーションの Red Hat build of Apache Camel for Quarkus への移行の概要

1.1. EAP 上の Fuse、Red Hat build of Apache Camel for Quarkus および Camel

1.1.1. Fuse

Red Hat Fuse は、Apache Camel や Apache Karaf などのオープンソースコミュニティーに基づくアジャイル統合ソリューションです。Red Hat Fuse は軽量かつ柔軟性のある統合プラットフォームで、オンプレミスのクラウドの迅速な統合を可能にします。

Red Hat Fuse は、次の 3 つの異なるランタイムを使用して実行できます。

  • OSGi アプリケーションをサポートする Karaf
  • Spring Boot
  • JBoss EAP (Enterprise Application Platform)

1.1.2. Red Hat build of Apache Camel for Quarkus

Red Hat build of Apache Camel for Quarkus は、Apache Camel とその膨大なコンポーネントライブラリーの統合機能を Quarkus ランタイムに提供します。Red Hat build of Camel Quarkus は、多くの Camel コンポーネントに Quarkus エクステンションを提供します。

Camel Quarkus は、Camel 3 に追加された多くのパフォーマンス上の改善点を活用します。これにより、メモリーフットプリントが削減し、リフレクションへの依存が減り、起動時間が短縮します。

Red Hat build of Apache Camel for Quarkus アプリケーションでは、Java DSL を使用して Camel ルートを定義するため、Fuse アプリケーションで使用する Camel ルートを CEQ に移行できます。

1.1.3. Camel on EAP

OSGI 依存関係管理の概念に従う Karaf と、JEE 仕様に従う EAP は、コンテナー化されたアプリケーションの採用の影響を受けるアプリケーションサーバーです。

コンテナーは、アプリケーションをパッケージ化するための主要な方法として出現しました。その結果、デプロイメント、スケーリング、クラスタリング、負荷分散を含むアプリケーション管理の役割が、アプリケーションサーバーから Kubernetes を使用したコンテナーオーケストレーションに移りました。

EAP は Red Hat Openshift で引き続きサポートされますが、Camel 3 は EAP サーバーではサポートされなくなりました。したがって、EAP サーバー上で Fuse 7 アプリケーションを実行している場合は、アプリケーションを Red Hat Build of Apache Camel for Spring Boot または Red Hat build of Apache Camel for Quarkus に移行することを検討する必要があります。その際、移行プロセスを利用して、モノリスアーキテクチャーからマイクロサービスアーキテクチャーへのアプリケーションの再設計、または部分的な再設計を検討することが推奨されます。

OpenShift を使用しない場合、Spring Boot および Quarkus を使用したアプリケーションのデプロイには、引き続き RHEL 仮想マシンを利用することが有効なアプローチとなります。また、Quarkus を使用する場合は、ネイティブコンパイル機能のメリットも得られます。このようなプラットフォーム上でマイクロサービスアーキテクチャーの管理をサポートするツールを評価することが重要です。

Red Hat は、Red Hat Ansible for Middleware コレクション を使用し、Ansible を通じてこの機能を提供します。

1.2. 標準的な移行パス

1.2.1. XML パス

Spring XML または Blueprint XML で記述された Fuse アプリケーションは、XML ベースのフレーバーに移行する必要があり、Spring Boot または Quarkus ランタイムのどちらかをターゲットにできます (移行手順はどちらも同じです)。

1.2.2. Java パス

Java DSL で記述された Fuse アプリケーションは Java ベースのフレーバーに移行する必要があり、移行手順は同じままで Spring Boot または Quarkus ランタイムのいずれかをターゲットにできます。

1.3. アーキテクチャーの変更

Openshift は Fabric8 に代わって Fuse 6 ユーザーのランタイムプラットフォームとなり、Fuse アプリケーションの移行における推奨ターゲットになります。

アプリケーションを移行するときは、次のアーキテクチャーの変更を考慮する必要があります。

  • Fuse 6 アプリケーションが Fabric8 サービスディスカバリーに依存していた場合は、OpenShift で Camel 3 を実行するときに Kubernetes Service Discovery を使用する必要があります。
  • Fuse 6 アプリケーションが OSGi バンドル設定に依存している場合は、OpenShift で Camel 3 を実行するときに Kubernetes ConfigMaps と Secret を使用する必要があります。
  • アプリケーションがファイルベースのルート定義を使用している場合は、OpenShift で Camel 3 を実行するときに AWS S3 テクノロジーの使用を検討してください。
  • アプリケーションが標準のファイルシステムを使用している場合は、結果として得られる Spring Boot または Quarkus アプリケーションを Openshift プラットフォームではなく標準の RHEL 仮想マシンにデプロイする必要があります。
  • SSL 要件を処理する Openshift Router へのインバウンド HTTPS 接続の委譲。
  • Hystrix 機能の Service Mesh への委譲。

1.4. javax から jakarta へのパッケージ名前空間の変更

Java EE は Eclipse Foundation に移行し、Jakarta EE が設立されました。Jakarta EE 9 以降、すべての EE API に使用されるパッケージは jakarta.* に変更されました。

ドキュメント内のコードスニペットは jakarta.* 名前空間を使用するように更新されています。ただし、お客様のアプリケーションは注意してご確認いただく必要があります。

注記

この変更は、Java SE に含まれる javax パッケージには影響しません。

アプリケーションを EE 10 に移行する場合は、次のことを行う必要があります。

  • import ステートメントまたはその他のソースコードにおける EE API クラスの使用を javax パッケージから jakarta に更新します。
  • 名前が javax. で始まる EE 指定のシステムプロパティーまたはその他の設定プロパティーを、jakarta. で始まるものに変更します。
  • META-INF/services/jakarta.[rest_of_name] 名前形式を使用して、実装 EE インターフェイスを使用するアプリケーション内の実装クラス、または java.util.ServiceLoader メカニズムでブートストラップされる抽象クラスを識別します。

1.4.1. 移行ツール

第2章 Camel ルートの Fuse 7 から Camel への移行

注記

Java DSL、XML IO DSL、または YAML を使用して、Red Hat build of Apache Camel for Quarkus アプリケーションで Camel ルートを定義できます。

2.1. Java DSL ルート移行の例

既存のルート定義を Red Hat build of Apache Camel for Quarkus アプリケーションに直接コピーし、必要な依存関係を Red Hat build of Apache Camel for Quarkus pom.xml ファイルに追加することで、Java DSL ルート定義を Fuse アプリケーションから CEQ に移行できます。

この例では、Java DSL ルートを CEQ アプリケーションの Routes.java という名前のファイルにコピーして、コンテンツベースのルート定義を Fuse 7 アプリケーションから新しい CEQ アプリケーションに移行します。

手順

  1. Web サイト code.quarkus.redhat.com を使用して、この例に必要なエクステンションを選択します。

    • camel-quarkus-file
    • camel-quarkus-xpath
  2. 直前の手順で生成されたプロジェクトファイルの展開先ディレクトリーに移動します。

    $ cd <directory_name>
    Copy to Clipboard
  3. src/main/java/org/acme/ サブフォルダーに Routes.java という名前のファイルを作成します。
  4. 次の例のように、Fuse アプリケーションから Routes.java にルート定義を追加します。

    package org.acme;
    
    import org.apache.camel.builder.RouteBuilder;
    
    public class Routes extends RouteBuilder {
    	// Add your Java DSL route definition here
        public void configure() {
    	    from("file:work/cbr/input")
                .log("Receiving order ${file:name}")
                .choice()
                    .when().xpath("//order/customer/country[text() = 'UK']")
                        .log("Sending order ${file:name} to the UK")
                        .to("file:work/cbr/output/uk")
                    .when().xpath("//order/customer/country[text() = 'US']")
                        .log("Sending order ${file:name} to the US")
                        .to("file:work/cbr/output/uk")
                    .otherwise()
                        .log("Sending order ${file:name} to another country")
                        .to("file:work/cbr/output/others");
        }
    
    }
    Copy to Clipboard
  5. CEQ アプリケーションをコンパイルします。

    mvn clean compile quarkus:dev
    Copy to Clipboard
注記

このコマンドでは、プロジェクトのコンパイル、アプリケーションの起動、Quarkus ツールでのワークスペースの変更監視などを行います。プロジェクトの変更は自動的に実行中のアプリケーションに適用されます。

2.2. Blueprint XML DSL ルートの移行

Blueprint XML ルート定義を Fuse アプリケーションから CEQ に移行するには、camel-quarkus-xml-io-dsl エクステンションを使用し、Fuse アプリケーションのルート定義を CEQ アプリケーションに直接コピーします。次に、必要な依存関係を CEQ pom.xml ファイルに追加し、application.properties ファイル内の CEQ 設定を更新する必要があります。

注記

CEQ は Camel 3 をサポートしますが、Fuse 7 は Camel 2 をサポートします。

Red Hat Fuse 7 アプリケーションを CEQ に移行する際の Camel のアップグレードに関する詳細は、Apache Camel の移行 を参照してください。

Camel Quarkus での Bean の使用に関する詳細は、Red Hat build of Apache Camel for Quarkus を使用したアプリケーションの開発 ガイドの CDI および Camel Bean コンポーネント セクションを参照してください。

2.2.1. XML-IO-DSL の制限事項

camel-quarkus-xml-io-dsl エクステンションを使用すると、Blueprint XML ルート定義の CEQ への移行を支援できます。

camel-quarkus-xml-io-dsl エクステンションは、次の <camelContext> サブ要素のみをサポートします。

  • routeTemplates
  • templatedRoutes
  • rests
  • routes
  • routeConfigurations
注記

Blueprint XML は camel-quarkus-xml-io-dsl エクステンションでサポートされていない他の Bean 定義をサポートしているため、Blueprint XML ルート定義に含まれる他の Bean 定義を書き直す必要が生じる場合があります。

すべての要素 (XML IO DSL) をそれぞれ別のファイルで定義する必要があります。たとえば、これは Blueprint XML ルート定義の簡単な例です。

<blueprint xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0">
    <camelContext xmlns="http://camel.apache.org/schema/blueprint">
        <restConfiguration contextPath="/camel" />
        <rest path="/books">
            <get uri="/">
                <to ..../>
            </get>
        </rest>
        <route>
            <from ..../>
        </route>
    </camelContext>
</blueprint>
Copy to Clipboard

次のファイルで定義されているように、XML IO DSL を使用して、この Blueprint XML ルート定義を CEQ に移行できます。

src/main/resources/routes/camel-rests.xml

<rests xmlns="http://camel.apache.org/schema/spring">
    <rest path="/books">
    <get path="/">
        <to ..../>
    </get>
    </rest>
</rests>
Copy to Clipboard

src/main/resources/routes/camel-routes.xml

<routes xmlns="http://camel.apache.org/schema/spring">
    <route>
        <from ..../>
    </route>
</routes>
Copy to Clipboard

<restConfiguration> など、サポートされていない他の要素を定義するには、Java DSL を使用する必要があります。たとえば、次のように、camel-rests.xml ファイルで定義されたルートビルダーを使用します。

src/main/resources/routes/camel-rests.xml

import org.apache.camel.builder.RouteBuilder;
public class Routes extends RouteBuilder {
    public void configure() {
       restConfiguration()
            .contextPath("/camel");
    }
}
Copy to Clipboard

2.2.2. Blueprint XML DSL ルート移行の例

注記

XML IO DSL エクステンションの使用に関する詳細は、Red Hat build of Apache Camel for Quarkus Extensions の XML IO DSL ドキュメントを参照してください。

この例では、Blueprint XML ルート定義を CEQ アプリケーションの camel-routes.xml という名前のファイルにコピーして、Fuse アプリケーションから新しい CEQ アプリケーションにコンテンツベースのルート定義を移行しています。

手順

  1. Web サイト code.quarkus.redhat.com を使用して、この例で使用する次のエクステンションを選択します。

    • camel-quarkus-xml-io-dsl
    • camel-quarkus-file
    • camel-quarkus-xpath
  2. Generate your application を選択して選択内容を確認し、生成されたプロジェクトを含むアーカイブのダウンロードリンクが記載されたオーバーレイ画面を表示します。
  3. Download the ZIP を選択して、生成されたプロジェクトファイルを含むアーカイブをマシンに保存します。
  4. アーカイブの内容をデプロイメントします。
  5. 直前の手順で生成されたプロジェクトファイルの展開先ディレクトリーに移動します。

    $ cd <directory_name>
    Copy to Clipboard
  6. src/main/resources/routes/ ディレクトリーに camel-routes.xml という名前のファイルを作成します。
  7. 次の例 blueprint-example.xml<route> 要素とサブ要素を camel-routes.xml ファイルにコピーします。

    blueprint-example.xml

    <blueprint xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0">
        <camelContext id="cbr-example-context" xmlns="http://camel.apache.org/schema/blueprint">
            <route id="cbr-route">
                <from id="_from1" uri="file:work/cbr/input"/>
                <log id="_log1" message="Receiving order ${file:name}"/>
                <choice id="_choice1">
                    <when id="_when1">
                        <xpath id="_xpath1">/order/customer/country = 'UK'</xpath>
                        <log id="_log2" message="Sending order ${file:name} to the UK"/>
                        <to id="_to1" uri="file:work/cbr/output/uk"/>
                    </when>
                    <when id="_when2">
                        <xpath id="_xpath2">/order/customer/country = 'US'</xpath>
                        <log id="_log3" message="Sending order ${file:name} to the US"/>
                        <to id="_to2" uri="file:work/cbr/output/us"/>
                    </when>
                    <otherwise id="_otherwise1">
                        <log id="_log4" message="Sending order ${file:name} to another country"/>
                        <to id="_to3" uri="file:work/cbr/output/others"/>
                    </otherwise>
                </choice>
                <log id="_log5" message="Done processing ${file:name}"/>
            </route>
        </camelContext>
    </blueprint>
    Copy to Clipboard

    camel-routes.xml

    <route id="cbr-route">
        <from id="_from1" uri="file:work/cbr/input"/>
        <log id="_log1" message="Receiving order ${file:name}"/>
        <choice id="_choice1">
            <when id="_when1">
                <xpath id="_xpath1">/order/customer/country = 'UK'</xpath>
                <log id="_log2" message="Sending order ${file:name} to the UK"/>
                <to id="_to1" uri="file:work/cbr/output/uk"/>
            </when>
            <when id="_when2">
                <xpath id="_xpath2">/order/customer/country = 'US'</xpath>
                <log id="_log3" message="Sending order ${file:name} to the US"/>
                <to id="_to2" uri="file:work/cbr/output/us"/>
            </when>
            <otherwise id="_otherwise1">
                <log id="_log4" message="Sending order ${file:name} to another country"/>
                <to id="_to3" uri="file:work/cbr/output/others"/>
            </otherwise>
        </choice>
        <log id="_log5" message="Done processing ${file:name}"/>
    </route>
    Copy to Clipboard

  8. application.properties を修正します。

    # Camel
    #
    camel.context.name = camel-quarkus-xml-io-dsl-example
    camel.main.routes-include-pattern = file:src/main/resources/routes/camel-routes.xml
    Copy to Clipboard
  9. CEQ アプリケーションをコンパイルします。

    mvn clean compile quarkus:dev
    Copy to Clipboard
    注記

    このコマンドでは、プロジェクトのコンパイル、アプリケーションの起動、Quarkus ツールでのワークスペースの変更監視などを行います。プロジェクトの変更は自動的に実行中のアプリケーションに適用されます。

法律上の通知

Copyright © 2025 Red Hat, Inc.
The text of and illustrations in this document are licensed by Red Hat under a Creative Commons Attribution–Share Alike 3.0 Unported license ("CC-BY-SA"). An explanation of CC-BY-SA is available at http://creativecommons.org/licenses/by-sa/3.0/. In accordance with CC-BY-SA, if you distribute this document or an adaptation of it, you must provide the URL for the original version.
Red Hat, as the licensor of this document, waives the right to enforce, and agrees not to assert, Section 4d of CC-BY-SA to the fullest extent permitted by applicable law.
Red Hat, Red Hat Enterprise Linux, the Shadowman logo, the Red Hat logo, JBoss, OpenShift, Fedora, the Infinity logo, and RHCE are trademarks of Red Hat, Inc., registered in the United States and other countries.
Linux® is the registered trademark of Linus Torvalds in the United States and other countries.
Java® is a registered trademark of Oracle and/or its affiliates.
XFS® is a trademark of Silicon Graphics International Corp. or its subsidiaries in the United States and/or other countries.
MySQL® is a registered trademark of MySQL AB in the United States, the European Union and other countries.
Node.js® is an official trademark of Joyent. Red Hat is not formally related to or endorsed by the official Joyent Node.js open source or commercial project.
The OpenStack® Word Mark and OpenStack logo are either registered trademarks/service marks or trademarks/service marks of the OpenStack Foundation, in the United States and other countries and are used with the OpenStack Foundation's permission. We are not affiliated with, endorsed or sponsored by the OpenStack Foundation, or the OpenStack community.
All other trademarks are the property of their respective owners.
トップに戻る
Red Hat logoGithubredditYoutubeTwitter

詳細情報

試用、購入および販売

コミュニティー

Red Hat ドキュメントについて

Red Hat をお使いのお客様が、信頼できるコンテンツが含まれている製品やサービスを活用することで、イノベーションを行い、目標を達成できるようにします。 最新の更新を見る.

多様性を受け入れるオープンソースの強化

Red Hat では、コード、ドキュメント、Web プロパティーにおける配慮に欠ける用語の置き換えに取り組んでいます。このような変更は、段階的に実施される予定です。詳細情報: Red Hat ブログ.

会社概要

Red Hat は、企業がコアとなるデータセンターからネットワークエッジに至るまで、各種プラットフォームや環境全体で作業を簡素化できるように、強化されたソリューションを提供しています。

Theme

© 2025 Red Hat