XML DSL은 코드 변경 없이 라우팅 규칙을 수정할 수 있다는 장점이 있습니다. 특히 Spring XML 설정 방식에 익숙한 팀이나, 운영 중 동적 변경이 필요한 경우에 유용합니다.
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:camel="http://camel.apache.org/schema/spring">
<camelContext id="camelContext"
xmlns="http://camel.apache.org/schema/spring">
<route id="order-route">
<from uri="file:orders/inbox?noop=true"/>
<log message="파일 수신: ${header.CamelFileName}"/>
<choice>
<when>
<simple>${header.CamelFileName} contains 'urgent'</simple>
<to uri="direct:urgentOrder"/>
</when>
<otherwise>
<to uri="direct:normalOrder"/>
</otherwise>
</choice>
</route>
</camelContext>
</beans> Spring Boot 환경에서는 application.yml로 Camel 기본 설정을 관리합니다.
camel:
springboot:
name: MyApp
main-run-controller: true
dataformat:
json-jackson:
auto-discover-object-mapper: true
# Camel 라우트 자동 검색 패턴
routes-include-pattern: "classpath:camel/*.xml" XML DSL에서 Spring Bean을 참조하는 방법입니다.
<!-- Spring Bean 정의 -->
<bean id="orderService" class="com.example.OrderService"/>
<!-- Camel 라우트에서 Bean 참조 -->
<route>
<from uri="direct:processOrder"/>
<bean ref="orderService" method="process"/>
<to uri="jms:queue:completed"/>
</route> 환경별 설정값을 외부화하는 것은 Camel에서도 중요합니다.
# application.properties
order.input.dir=orders/inbox
jms.queue.name=orderQueue
retry.count=3 <!-- XML DSL에서 프로퍼티 사용 -->
<route>
<from uri="file:{{order.input.dir}}?noop=true"/>
<to uri="jms:queue:{{jms.queue.name}}"/>
</route> // Java DSL에서 프로퍼티 사용
from("file:{{order.input.dir}}?noop=true")
.to("jms:queue:{{jms.queue.name}}"); Camel 3.x 이후 YAML DSL도 지원합니다. Camel K (클라우드 네이티브 통합)에서 주로 사용됩니다.
- route:
id: order-route
from:
uri: "file:orders/inbox"
parameters:
noop: true
steps:
- log:
message: "파일 수신: ${header.CamelFileName}"
- to: "jms:queue:orders" 2025년 Apache Camel의 최신 트렌드를 분석합니다. AI/LLM 통합 컴포넌트, 서버리스 배포, Camel K 진화, WebAssembly…
Camel in Action을 완독한 후 Apache Camel의 전체 그림을 다시 정리합니다. 핵심 철학, 학습 경로,…
Apache Camel 2.x에서 3.x, 4.x로 마이그레이션하는 단계별 가이드입니다. 주요 API 변경사항, 제거된 컴포넌트, 자동화 도구…
Apache Camel 라우트에서 발생하는 문제를 디버깅하고 해결하는 실전 기법을 설명합니다. 로그 분석, breakpoint 디버깅, Tracer,…
Apache Camel을 프로젝트에 도입하기 전 알아야 할 핵심 사항을 정리합니다. 학습 곡선, 도입 비용, 적합한…
엔터프라이즈 통합 패턴(EIP) 20가지를 Apache Camel 코드와 함께 한 번에 정리합니다. 메시징 채널, 메시지 라우팅,…