SlideShare a Scribd company logo
Camel In Action 2nd edition 読書会
2020年11⽉17⽇
15. Running and Deploying Camel
起動の流れ
20202
public static void main(String[] args) throws Exception {
CamelContext context = new DefaultCamelContext();
context.addRoutes(new RouteBuilder() {
@Override
public void configure() throws Exception {
from("stream:in").to("direct:greetings");
from("direct:greetings").to("stream:out");
}
});
context.start();
context.getRoutes().forEach(r -> LOGGER.info(r.toString()));
context.stop();
}
}
起動フェーズ1:
CamelContextのインスタンス
を⽣成
起動フェーズ2:
CamelContext.start()を実⾏
l コンテナとは、Spring-Boot, CDI, OSGiなどを指す
l コンテナ⾃⾝の内部サービスの初期化の後、CamelContextを初期化す
る
l コンテナによってCamelContext⽣成する⽅法が異なる
l Spring-boot XMLの場合、<camelContext xmlns="…"/>
起動フェーズ1: コンテナがCamelContextのインスタ
ンスを⽣成
20203
l CamelContext.start()内で⾏われた処理
1. Internal Servicesの起動
2. Route起動順の計算
3. Routeの起動準備
4. Routeの起動
起動フェーズ2: コンテナがCamelContext.start()を実
⾏
20204
l CamelContext/Routeの動きをカスタマイズ��能なオプション
CamelContext/Routeのオプション
20205
Java DSLの場合は、
setXXX()で⾏う
XML DSLの場合は、
camelContextタグ
の属性に設定する
CamelContext/Routeのオプション(1)
20206
CamelContext
レベルのオプション
Route
レベルのオプション
デフォルト
AutoStartup ○ ○ true Routeの⾃動起動
StartupOrder ○ - Routeの起動順(1-999の数字を推奨)
※ startupOrderが重複の場合、起動失敗
する
※ 最後に起動するため、例えば、10000以
上に設定する
ShutdownRoute ○ ○ default default: Route処理が終われば、即時停⽌
defer: Route処理が終わっても停⽌を遅延
ShutdownRunningTask ○ ○ Complet
eAllTasks
CompleteAllTasks: 全Task完了してから、
Route停⽌
CompleteCurrentTaskOnly: 現在処理中
Taskが完了したら、Route停⽌
CamelContext/Routeのオプション(2)
20207
CamelContext
レベルのオプション
Route
レベルのオプション
デフォルト
Tracing ○ ○ false メッセージのトレース出⼒する設定。DEBUG時
に便利。
Delayer ○ ○ disable メッセージ処理を遅延させる設定。DEBUG時
に便利。
MessageHistory ○ ○ true MessageHistory出⼒を有効化の設定。
11章を参照
HandleFault ○ ○ false CXFを使う場合、SOAP FaultをExceptionと
して扱うか
StreamCaching ○ ○ false Streamオブジェクトのキャッシュ機能
AllowUseOriginalMessage ○ true Consumerが受け取ったOriginalの
Exchangeを利⽤可能にするかの設定
LogExhaustedMessageBody ○ false MessageHistoryにBodyを出⼒するの設定
LogMask ○ ○ false ログ出⼒(logコンポーネント, Log EIP,
tracerなど)時、機密情報のマスキング設定
l https://qiita.com/mkyz08/items/f8f7b6c3ef2d650ffd49
l routeの⾃動起動をオフにする
<route id="mainRoute" autoStartup="false">
l routeの起動順を制御する
<route id="mainRoute" startupOrder="1">
l routeの停⽌順
l routeは起動順と逆に停⽌する
l route毎にGracefulShutdownが⾏われて、最終的に強制Shutdown
l GracefulShutdownのタイムアウトはデフォルトで300秒
Routeの起動・停⽌/起動順を制御する
20208
1. CamelContext
l startRoute()
l startAllRoutes()
l stopRoute()
2. ControlBus EIP
l EIPである
l Route内で実⾏可能
3. RoutePolicy
l RoutePolicySupportを拡張
l CamelからCallback
4. JMX
l リモートから制御可能
l ManagedRoute Mean
l Start()
l Stop()
l 詳細は16章で紹介
Routeの起動・停⽌をプログラムで制御する⽅法
20209
JVM
Runtime
(Karaf/SpringBoot/WildFly/Tomcat)
CamelContext
Route1
Route2
JMX
RoutePolicy
ControlBus EIP
CamelContext
例:「onCompletion + CamelContext.stop()」を使って、1つファイル
を処理後に、Route(⾃⾝)を停⽌する
Routeの起動・停⽌をプログラムで制御する⽅法
⽅法1: CamelContext
202010
camelinaction2/chapter15/startup/src/test/resources/META-INF/spring/SpringManualRouteWithOnCompletionTest.xml
<route id="manual" autoStartup="false">
<from uri="file://target/inventory/manual?maxMessagesPerPoll=1"/>

<onCompletion>
<process ref="stopRouteProcessor"/>
</onCompletion>
<log message="Doing manual update with file ${file:name}"/>
<split>

<tokenize token="n"/>
<convertBodyTo type="camelinaction.inventory.UpdateInventoryInput"/>
<to uri="direct:update"/>
</split>
</route>
Routeの⾃動起動をオフにする
ファイル1回のみ処理にする
Route処理完了時に、Processorを実⾏して、Route
を停⽌する
※ Processor内でCamelContext.stopRoute()
例: CamelContext.stopRoute()を使うProcessorの実装
Routeの起動・停⽌をプログラムで制御する⽅法
⽅法1: CamelContext (続き)
202011
camelinaction2/chapter15/startup/src/test/java/camelinaction/StopRouteProcessor.java
/**
* @param name route to stop
*/
public StopRouteProcessor(String name) {
this.name = name;
}
public void process(Exchange exchange) throws Exception {
// force stopping this route while we are routing an Exchange
// requires two steps:
// 1) unregister from the inflight registry
// 2) stop the route
LOG.info("Stopping route: " + name);
exchange.getContext().getInflightRepository().remove(exchange, name);
exchange.getContext().stopRoute(name);
}
InflightRepositoryからExchangeを削除
して置かないと、現在ExchangeがInflight
中のWARNがログに出る
Processor初期化時に、停⽌するRoute名をメン
バー変数にセットするため
指定したRouteを停⽌する
例:「ControlBus EIP」 を使って、1つファイルを処理後に、Route(⾃
⾝)を停⽌する
Routeの起動・停⽌をプログラムで制御する⽅法
⽅法2: ControlBus EIP
202012
camelinaction2/chapter15/controlbus/src/test/java/camelinaction/ControlBusRoute.java
// ensure we only pickup one file at any given time
from("file://target/inventory/manual?maxMessagesPerPoll=1")
// use noAutoStartup to indicate this route should
// NOT be started when Camel starts
.routeId("manual").noAutoStartup()
.log("Doing manual update with file ${file:name}")
.split(body().tokenize("n"))
.convertBodyTo(UpdateInventoryInput.class)
.to("direct:update")
.end()
// use end() to denote the end of the splitter sub-route
.to("controlbus:route?routeId=manual&action=stop&async=true");
}
Routeの⾃動起動をオフにする
ファイル1回のみ処理にする
Route処理完了時に、ControlBus EIPを実⾏して、
Routeを停⽌する
org.apache.camel.spi Interface RoutePolicyのメソッドを実装することで、
Camelが条件に満たしたタイミングで該当メソッドをCallbackします。
Routeの起動・停⽌をプログラムで制御する⽅法
⽅法3: RoutePolicy
202013
指定RouteのExchange処理の開始時
指定RouteのExchange処理の完了時
指定Routeの初期化時
指定Routeのシャットダウン時
指定Routeの再開時
指定Routeの起動時
指定Routeの停⽌時
指定Routeの⼀時停⽌時
例:「RoutePolicy」を使って、Route[foo]とRoute[bar]を交互に起動する
(foo -> bar -> foo -> bar -> …)
Routeの起動・停⽌をプログラムで制御する⽅法
⽅法3: RoutePolicy(続き)
202014
camelinaction2/chapter15/routepolicy/src/test/resources/camel-fliproute.xml
<bean id="flipPolicy" class="camelinaction.FlipRoutePolicy">
<constructor-arg index="0" value="foo"/>
<constructor-arg index="1" value="bar"/>
</bean>
<camelContext xmlns="http://camel.apache.org/schema/spring">

<route id="foo" routePolicyRef="flipPolicy">
<from uri="timer:foo?delay=500"/>
<setBody><constant>Foo message</constant></setBody>
<to uri="log:foo"/>
<to uri="mock:foo"/>
</route>

<route id="bar" routePolicyRef="flipPolicy" autoStartup="false">
<from uri="timer:bar?delay=500"/>
<setBody><constant>Bar message</constant></setBody>
<to uri="log:bar"/>
<to uri="mock:bar"/>
</route>
</camelContext>
カスタムRoutePolicyを適⽤する
カスタムRoutePolicyを
初期化する
Routeの⾃動起動をオフにして、
カスタムRoutePolicyを適⽤する
例: カスタムRoutePolicyの実装例
Routeの起動・停⽌をプログラムで制御する⽅法
⽅法3: RoutePolicy (続き)
202015
camelinaction2/chapter15/routepolicy/src/test/java/camelinaction/FlipRoutePolicy.java
public class FlipRoutePolicy extends RoutePolicySupport {
public FlipRoutePolicy(String name1, String name2) {
this.name1 = name1;
this.name2 = name2;
}
@Override
public void onExchangeDone(Route route, Exchange exchange) {
String stop = route.getId().equals(name1) ? name1 : name2;
String start = route.getId().equals(name1) ? name2 : name1;
CamelContext context = exchange.getContext();
try {
context.getInflightRepository().remove(exchange);
context.stopRoute(stop);
context.startRoute(start);
} catch (Exception e) {
// let the exception handle handle it, which is often just to log it
getExceptionHandler().handleException("Error flipping routes", e);
}
}
}
カスタムRoutePolicyの初期化時
に、制御するRoute名をメンバー変
数にセットするため
org.apache.camel.impl.RoutePolicySupport
を拡張する
Exchange処理完了時
のCallbackを実装する
交互に起動/停⽌を実現
するため、Start/Stopす
るRoute名を⼊れ替え
InflightRepositoryからExchangeを
削して、Route1を停⽌し、Route2を
起動する
l Routeが停⽌する際に、処理中Exchangeがない場合、即時に停⽌処理が
⾏われます。
l Routeが停⽌する際に処理中Exchangeがあった場合は、処理中のデータ
が無くなるまで停⽌処理を待機します(Graceful Shutdown)
l デフォルトで300秒経過しても処理中のデータがあって停⽌が完了しない
場合は、Routeが強制的に停⽌されます。
GracefulShutdownを制御する
202016
SpringCamelContext - Apache Camel 2.20.1 (CamelContext: camel-1) is shutting down
DefaultShutdownStrategy - Starting to graceful shutdown 3 routes (timeout 10 seconds)
DefaultShutdownStrategy - Route: webservice shutdown complete, was consuming from:
cxf://bean:inventoryEndpoint
DefaultShutdownStrategy - Route: file shutdown complete, was consuming from:
file://target/inventory/updates
DefaultShutdownStrategy - Route: update shutdown complete, was consuming from:
direct://update
DefaultShutdownStrategy - Graceful shutdown of 3 routes completed in 0 seconds
SpringCamelContext - Apache Camel 2.20.1 (CamelContext: camel-1) uptime 0.684 seconds
SpringCamelContext - Apache Camel 2.20.1 (CamelContext: camel-1) is shutdown in 0.025
seconds
DefaultShutdownStrategy - Waiting as there are still 3 inflight and pending exchanges to
complete, timeout in 60 seconds
Inflights per route: [file = 2, update = 1]
ログ
ログ
l GracefulShutdownの待機時間のデフォルト値が300秒
l Junitから実⾏の場合、CamelTestSupportによって10秒にセット
l 待機時間を変更するには、
GracefulShutdownの待機時間
202017
context.getShutdownStrategy().setTimeout(20);
Java DSL
<bean id="shutdown"
class="org.apache.camel.impl.DefaultShutdownStrategy">
<property name="timeout" value="20"/>
</bean>
XML DSL
※ 他のオプションは、https://camel.apache.org/manual/latest/graceful-shutdown.html を参照
l Camel on Spring-boot
l Camel on Quarkus
l Embedding Camel in a Java application
l Running Camel in a web environment such as Apache Tomcat
l Running Camel inside WildFly
l Running Camel in an OSGi container such as Apache Karaf
l Running Camel in a container that supports CDI, such as
Apache Karaf or WildFly
Deploying Camel
202018
Camel on Quarkus
202019
https://www.slideshare.net/davsclaus/apache-camel-v3-camel-k-and-camel-quarkus
Camel on Quarkus
202020
l Quarkusとは
l Java仮想マシン (JVM) およびネイティブコンパイルの
ために作成されたフルスタックのJavaフレームワーク
l Java標準フレームワーク以外に、 Eclipse MicroProfile
と CDI (コンテキストと依存性注⼊) を備え
l Apache Kafka、RESTEasy (JAX-RS)、Hibernate ORM
(JPA)、Spring、Infinispan、Camel およびその他多数
のライブラリと組み合わせ可能
l Camel on Quarkus
l 300+ コンポーネントをQuarkus extensions
の形で提供
l Quarkusで実装した MicroProfileと連携
Microprofile
Quarkus
OpenJDK or GraalVM
Camel on Quarkus
202021
https://www.slideshare.net/davsclaus/apache-camel-v3-camel-k-and-camel-quarkus

More Related Content

15. running deploying camel

  • 1. Camel In Action 2nd edition 読書会 2020年11⽉17⽇ 15. Running and Deploying Camel
  • 2. 起動の流れ 20202 public static void main(String[] args) throws Exception { CamelContext context = new DefaultCamelContext(); context.addRoutes(new RouteBuilder() { @Override public void configure() throws Exception { from("stream:in").to("direct:greetings"); from("direct:greetings").to("stream:out"); } }); context.start(); context.getRoutes().forEach(r -> LOGGER.info(r.toString())); context.stop(); } } 起動フェーズ1: CamelContextのインスタンス を⽣成 起動フェーズ2: CamelContext.start()を実⾏
  • 3. l コンテナとは、Spring-Boot, CDI, OSGiなどを指す l コンテナ⾃⾝の内部サービスの初期化の後、CamelContextを初期化す る l コンテナによってCamelContext⽣成する⽅法が異なる l Spring-boot XMLの場合、<camelContext xmlns="…"/> 起動フェーズ1: コンテナがCamelContextのインスタ ンスを⽣成 20203
  • 4. l CamelContext.start()内で⾏われた処理 1. Internal Servicesの起動 2. Route起動順の計算 3. Routeの起動準備 4. Routeの起動 起動フェーズ2: コンテナがCamelContext.start()を実 ⾏ 20204
  • 6. CamelContext/Routeのオプション(1) 20206 CamelContext レベルのオプション Route レベルのオプション デフォルト AutoStartup ○ ○ true Routeの⾃動起動 StartupOrder ○ - Routeの起動順(1-999の数字を推奨) ※ startupOrderが重複の場合、起動失敗 する ※ 最後に起動するため、例えば、10000以 上に設定する ShutdownRoute ○ ○ default default: Route処理が終われば、即時停⽌ defer: Route処理が終わっても停⽌を遅延 ShutdownRunningTask ○ ○ Complet eAllTasks CompleteAllTasks: 全Task完了してから、 Route停⽌ CompleteCurrentTaskOnly: 現在処理中 Taskが完了したら、Route停⽌
  • 7. CamelContext/Routeのオプション(2) 20207 CamelContext レベルのオプション Route レベルのオプション デフォルト Tracing ○ ○ false メッセージのトレース出⼒する設定。DEBUG時 に便利。 Delayer ○ ○ disable メッセージ処理を遅延させる設定。DEBUG時 に便利。 MessageHistory ○ ○ true MessageHistory出⼒を有効化の設定。 11章を参照 HandleFault ○ ○ false CXFを使う場合、SOAP FaultをExceptionと して扱うか StreamCaching ○ ○ false Streamオブジェクトのキャッシュ機能 AllowUseOriginalMessage ○ true Consumerが受け取ったOriginalの Exchangeを利⽤可能にするかの設定 LogExhaustedMessageBody ○ false MessageHistoryにBodyを出⼒するの設定 LogMask ○ ○ false ログ出⼒(logコンポーネント, Log EIP, tracerなど)時、機密情報のマスキング設定
  • 8. l https://qiita.com/mkyz08/items/f8f7b6c3ef2d650ffd49 l routeの⾃動起動をオフにする <route id="mainRoute" autoStartup="false"> l routeの起動順を制御する <route id="mainRoute" startupOrder="1"> l routeの停⽌順 l routeは起動順と逆に停⽌する l route毎にGracefulShutdownが⾏われて、最終的に強制Shutdown l GracefulShutdownのタイムアウトはデフォルトで300秒 Routeの起動・停⽌/起動順を制御する 20208
  • 9. 1. CamelContext l startRoute() l startAllRoutes() l stopRoute() 2. ControlBus EIP l EIPである l Route内で実⾏可能 3. RoutePolicy l RoutePolicySupportを拡張 l CamelからCallback 4. JMX l リモートから制御可能 l ManagedRoute Mean l Start() l Stop() l 詳細は16章で紹介 Routeの起動・停⽌をプログラムで制御する⽅法 20209 JVM Runtime (Karaf/SpringBoot/WildFly/Tomcat) CamelContext Route1 Route2 JMX RoutePolicy ControlBus EIP CamelContext
  • 10. 例:「onCompletion + CamelContext.stop()」を使って、1つファイル を処理後に、Route(⾃⾝)を停⽌する Routeの起動・停⽌をプログラムで制御する⽅法 ⽅法1: CamelContext 202010 camelinaction2/chapter15/startup/src/test/resources/META-INF/spring/SpringManualRouteWithOnCompletionTest.xml <route id="manual" autoStartup="false"> <from uri="file://target/inventory/manual?maxMessagesPerPoll=1"/> <!-- on completion which will stop the route using the processor --> <onCompletion> <process ref="stopRouteProcessor"/> </onCompletion> <log message="Doing manual update with file ${file:name}"/> <split> <!-- split the body using a tokenizer --> <tokenize token="n"/> <convertBodyTo type="camelinaction.inventory.UpdateInventoryInput"/> <to uri="direct:update"/> </split> </route> Routeの⾃動起動をオフにする ファイル1回のみ処理にする Route処理完了時に、Processorを実⾏して、Route を停⽌する ※ Processor内でCamelContext.stopRoute()
  • 11. 例: CamelContext.stopRoute()を使うProcessorの実装 Routeの起動・停⽌をプログラムで制御する⽅法 ⽅法1: CamelContext (続き) 202011 camelinaction2/chapter15/startup/src/test/java/camelinaction/StopRouteProcessor.java /** * @param name route to stop */ public StopRouteProcessor(String name) { this.name = name; } public void process(Exchange exchange) throws Exception { // force stopping this route while we are routing an Exchange // requires two steps: // 1) unregister from the inflight registry // 2) stop the route LOG.info("Stopping route: " + name); exchange.getContext().getInflightRepository().remove(exchange, name); exchange.getContext().stopRoute(name); } InflightRepositoryからExchangeを削除 して置かないと、現在ExchangeがInflight 中のWARNがログに出る Processor初期化時に、停⽌するRoute名をメン バー変数にセットするため 指定したRouteを停⽌する
  • 12. 例:「ControlBus EIP」 を使って、1つファイルを処理後に、Route(⾃ ⾝)を停⽌する Routeの起動・停⽌をプログラムで制御する⽅法 ⽅法2: ControlBus EIP 202012 camelinaction2/chapter15/controlbus/src/test/java/camelinaction/ControlBusRoute.java // ensure we only pickup one file at any given time from("file://target/inventory/manual?maxMessagesPerPoll=1") // use noAutoStartup to indicate this route should // NOT be started when Camel starts .routeId("manual").noAutoStartup() .log("Doing manual update with file ${file:name}") .split(body().tokenize("n")) .convertBodyTo(UpdateInventoryInput.class) .to("direct:update") .end() // use end() to denote the end of the splitter sub-route .to("controlbus:route?routeId=manual&action=stop&async=true"); } Routeの⾃動起動をオフにする ファイル1回のみ処理にする Route処理完了時に、ControlBus EIPを実⾏して、 Routeを停⽌する
  • 13. org.apache.camel.spi Interface RoutePolicyのメソッドを実装することで、 Camelが条件に満たしたタイミングで該当メソッドをCallbackします。 Routeの起動・停⽌をプログラムで制御する⽅法 ⽅法3: RoutePolicy 202013 指定RouteのExchange処理の開始時 指定RouteのExchange処理の完了時 指定Routeの初期化時 指定Routeのシャットダウン時 指定Routeの再開時 指定Routeの起動時 指定Routeの停⽌時 指定Routeの⼀時停⽌時
  • 14. 例:「RoutePolicy」を使って、Route[foo]とRoute[bar]を交互に起動する (foo -> bar -> foo -> bar -> …) Routeの起動・停⽌をプログラムで制御する⽅法 ⽅法3: RoutePolicy(続き) 202014 camelinaction2/chapter15/routepolicy/src/test/resources/camel-fliproute.xml <bean id="flipPolicy" class="camelinaction.FlipRoutePolicy"> <constructor-arg index="0" value="foo"/> <constructor-arg index="1" value="bar"/> </bean> <camelContext xmlns="http://camel.apache.org/schema/spring"> <!-- the foo route uses the flipPolicy --> <route id="foo" routePolicyRef="flipPolicy"> <from uri="timer:foo?delay=500"/> <setBody><constant>Foo message</constant></setBody> <to uri="log:foo"/> <to uri="mock:foo"/> </route> <!-- the bar route uses the flipPolicy and is NOT started on startup --> <route id="bar" routePolicyRef="flipPolicy" autoStartup="false"> <from uri="timer:bar?delay=500"/> <setBody><constant>Bar message</constant></setBody> <to uri="log:bar"/> <to uri="mock:bar"/> </route> </camelContext> カスタムRoutePolicyを適⽤する カスタムRoutePolicyを 初期化する Routeの⾃動起動をオフにして、 カスタムRoutePolicyを適⽤する
  • 15. 例: カスタムRoutePolicyの実装例 Routeの起動・停⽌をプログラムで制御する⽅法 ⽅法3: RoutePolicy (続き) 202015 camelinaction2/chapter15/routepolicy/src/test/java/camelinaction/FlipRoutePolicy.java public class FlipRoutePolicy extends RoutePolicySupport { public FlipRoutePolicy(String name1, String name2) { this.name1 = name1; this.name2 = name2; } @Override public void onExchangeDone(Route route, Exchange exchange) { String stop = route.getId().equals(name1) ? name1 : name2; String start = route.getId().equals(name1) ? name2 : name1; CamelContext context = exchange.getContext(); try { context.getInflightRepository().remove(exchange); context.stopRoute(stop); context.startRoute(start); } catch (Exception e) { // let the exception handle handle it, which is often just to log it getExceptionHandler().handleException("Error flipping routes", e); } } } カスタムRoutePolicyの初期化時 に、制御するRoute名をメンバー変 数にセットするため org.apache.camel.impl.RoutePolicySupport を拡張する Exchange処理完了時 のCallbackを実装する 交互に起動/停⽌を実現 するため、Start/Stopす るRoute名を⼊れ替え InflightRepositoryからExchangeを 削して、Route1を停⽌し、Route2を 起動する
  • 16. l Routeが停⽌する際に、処理中Exchangeがない場合、即時に停⽌処理が ⾏われます。 l Routeが停⽌する際に処理中Exchangeがあった場合は、処理中のデータ が無くなるまで停⽌処理を待機します(Graceful Shutdown) l デフォルトで300秒経過しても処理中のデータがあって停⽌が完了しない 場合は、Routeが強制的に停⽌されます。 GracefulShutdownを制御する 202016 SpringCamelContext - Apache Camel 2.20.1 (CamelContext: camel-1) is shutting down DefaultShutdownStrategy - Starting to graceful shutdown 3 routes (timeout 10 seconds) DefaultShutdownStrategy - Route: webservice shutdown complete, was consuming from: cxf://bean:inventoryEndpoint DefaultShutdownStrategy - Route: file shutdown complete, was consuming from: file://target/inventory/updates DefaultShutdownStrategy - Route: update shutdown complete, was consuming from: direct://update DefaultShutdownStrategy - Graceful shutdown of 3 routes completed in 0 seconds SpringCamelContext - Apache Camel 2.20.1 (CamelContext: camel-1) uptime 0.684 seconds SpringCamelContext - Apache Camel 2.20.1 (CamelContext: camel-1) is shutdown in 0.025 seconds DefaultShutdownStrategy - Waiting as there are still 3 inflight and pending exchanges to complete, timeout in 60 seconds Inflights per route: [file = 2, update = 1] ログ ログ
  • 17. l GracefulShutdownの待機時間のデフォルト値が300秒 l Junitから実⾏の場合、CamelTestSupportによって10秒にセット l 待機時間を変更するには、 GracefulShutdownの待機時間 202017 context.getShutdownStrategy().setTimeout(20); Java DSL <bean id="shutdown" class="org.apache.camel.impl.DefaultShutdownStrategy"> <property name="timeout" value="20"/> </bean> XML DSL ※ 他のオプションは、https://camel.apache.org/manual/latest/graceful-shutdown.html を参照
  • 18. l Camel on Spring-boot l Camel on Quarkus l Embedding Camel in a Java application l Running Camel in a web environment such as Apache Tomcat l Running Camel inside WildFly l Running Camel in an OSGi container such as Apache Karaf l Running Camel in a container that supports CDI, such as Apache Karaf or WildFly Deploying Camel 202018
  • 20. Camel on Quarkus 202020 l Quarkusとは l Java仮想マシン (JVM) およびネイティブコンパイルの ために作成されたフルスタックのJavaフレームワーク l Java標準フレームワーク以外に、 Eclipse MicroProfile と CDI (コンテキストと依存性注⼊) を備え l Apache Kafka、RESTEasy (JAX-RS)、Hibernate ORM (JPA)、Spring、Infinispan、Camel およびその他多数 のライブラリと組み合わせ可能 l Camel on Quarkus l 300+ コンポーネントをQuarkus extensions の形で提供 l Quarkusで実装した MicroProfileと連携 Microprofile Quarkus OpenJDK or GraalVM