camel-JndiRegistry

来源:互联网 发布:手机淘宝生日在哪设置 编辑:程序博客网 时间:2024/06/07 08:26

JndiRegistry正如它的名字一样是基于JNDI的注册,它是camel集成的第一个注册,因此也是camel默认的注册。

JndiRegistry经常是被用来测试或者单独运行camle,在camel中大部分的单元测试都是使用JndiRegistry,因为它在SimpleRegistry添加到Camel之前被创建的。


假如在应用服务器中你需要用到JNDI registry,你可以向下面的方式去做:

protected CamelContext  createCamelContext() throws Exception {

Hashtable env = new Hashtable();

env.put(Context.INITIAL_CONTEXT_FACTORY, "com.ibm.websphere.naming.WsnInitialContextFactory");

env.put(Context.PROVIDER_URL, "corbaloc:iiop:myhost.mycompany.com:2809");

env.put(Context.SECURITY_PRINCIPAL, "username");

env.put(Context.SECURITY_CREDENTIALS, "password");

Context ctx = new InitialContext(env);

JndiRegistry jndi = new JndiRegistry(ctx);

return new DefaultCamelContext(jndi);

}



0 0
原创粉丝点击