5.8. JNDI

JNDI 통합은 다음과 같이 JBoss EAP 특정 CamelContext에서 제공합니다.

InitialContext inictx = new InitialContext();
CamelContextFactory factory = inictx.lookup("java:jboss/camel/CamelContextFactory");
WildFlyCamelContext camelctx = factory.createCamelContext();

WildFlyCamelContext 에서 사전 구성된 이름 지정 컨텍스트를 얻을 수 있습니다.

Context context = camelctx.getNamingContext();
context.bind("helloBean", new HelloBean());

그런 다음 Camel 경로에서 참조할 수 있습니다.

camelctx.addRoutes(new RouteBuilder() {
    @Override
    public void configure() throws Exception {
        from("direct:start").beanRef("helloBean");
    }
});
camelctx.start();