5.8. JNDI
JNDI 集成由 JBoss EAP 特定的 CamelContext 提供,如下所示:
InitialContext inictx = new InitialContext();
CamelContextFactory factory = inictx.lookup("java:jboss/camel/CamelContextFactory");
WildFlyCamelContext camelctx = factory.createCamelContext();
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());
Context context = camelctx.getNamingContext();
context.bind("helloBean", new HelloBean());
然后可从 Camel 路由中引用该路由。