60.9. CDI 이벤트에 대한 Camel 이벤트


Camel 2.17 사용 가능

Camel은 Camel 컨텍스트, 서비스, 경로 및 교환 이벤트를 수신하기 위해 서브스크립션할 수 있는 관리 이벤트 세트를 제공합니다. Camel CDI는 CDI 관찰자 방법을 사용하여 확인할 수 있는 CDI 이벤트로 이러한 Camel 이벤트를 원활하게 변환합니다. 예를 들면 다음과 같습니다.

void onContextStarting(@Observes CamelContextStartingEvent event) {
    // Called before the default Camel context is about to start
}

Camel 2.18부터 특정 경로(RouteAddedEvent,RouteStartedEvent,RouteStoppedEventRouteRemovedEvent)에 대한 이벤트를 확인할 수 있습니다. 예를 들면 다음과 같습니다.

from("...").routeId("foo").to("...");

void onRouteStarted(@Observes @Named("foo") RouteStartedEvent event) {
    // Called after the route "foo" has started
}

CDI 컨테이너에 여러 Camel 컨텍스트가 있는 경우 @ContextName 과 같은 Camel 컨텍스트 빈 한정자를 사용하여 관찰자 확인에 지정된 대로 관찰자 방법 해상도를 특정 Camel 컨텍스트로 조정할 수 있습니다. 예를 들면 다음과 같습니다. http://docs.jboss.org/cdi/spec/1.2/cdi-spec.html#observer_resolution

void onRouteStarted(@Observes @ContextName("foo") RouteStartedEvent event) {
    // Called after the route 'event.getRoute()' for the Camel context 'foo' has started
}

void onContextStarted(@Observes @Manual CamelContextStartedEvent event) {
    // Called after the Camel context qualified with '@Manual' has started
}

마찬가지로, 여러 컨텍스트가 존재하는 경우 @Default 한정자를 사용하여 기본 Camel 컨텍스트의 Camel 이벤트를 관찰할 수 있습니다. 예를 들면 다음과 같습니다.

void onExchangeCompleted(@Observes @Default ExchangeCompletedEvent event) {
    // Called after the exchange 'event.getExchange()' processing has completed
}

이 예에서 한정자가 지정되지 않은 경우 모든 Camel 컨텍스트에 대한 해당 이벤트가 수신되도록 @Any 한정자를 암시적으로 가정합니다.

CDI 이벤트로의 Camel 이벤트 변환 지원은 배포에서 Camel 이벤트를 청취하는 관찰자 방법과 Camel 컨텍스트별로 감지되는 경우에만 활성화됩니다.

Red Hat logoGithubredditYoutubeTwitter

자세한 정보

평가판, 구매 및 판매

커뮤니티

Red Hat 문서 정보

Red Hat을 사용하는 고객은 신뢰할 수 있는 콘텐츠가 포함된 제품과 서비스를 통해 혁신하고 목표를 달성할 수 있습니다. 최신 업데이트를 확인하세요.

보다 포괄적 수용을 위한 오픈 소스 용어 교체

Red Hat은 코드, 문서, 웹 속성에서 문제가 있는 언어를 교체하기 위해 최선을 다하고 있습니다. 자세한 내용은 다음을 참조하세요.Red Hat 블로그.

Red Hat 소개

Red Hat은 기업이 핵심 데이터 센터에서 네트워크 에지에 이르기까지 플랫폼과 환경 전반에서 더 쉽게 작업할 수 있도록 강화된 솔루션을 제공합니다.

Theme

© 2026 Red Hat
맨 위로 이동