本文整理汇总了Java中org.apache.camel.util.jndi.JndiContext.bind方法的典型用法代码示例。如果您正苦于以下问题:Java JndiContext.bind方法的具体用法?Java JndiContext.bind怎么用?Java JndiContext.bind使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.apache.camel.util.jndi.JndiContext
的用法示例。
在下文中一共展示了JndiContext.bind方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: testCamelWithJndi
import org.apache.camel.util.jndi.JndiContext; //导入方法依赖的package包/类
public void testCamelWithJndi() throws Exception {
JndiContext jndi = new JndiContext();
jndi.bind("foo", new MyOtherDummyBean());
CamelContext camel = new DefaultCamelContext(jndi);
camel.addRoutes(new RouteBuilder() {
@Override
public void configure() throws Exception {
from("direct:start").bean("foo");
}
});
camel.start();
String reply = camel.createProducerTemplate().requestBody("direct:start", "Camel", String.class);
assertEquals("Hello Camel", reply);
camel.stop();
}
示例2: testPojoRoutes
import org.apache.camel.util.jndi.JndiContext; //导入方法依赖的package包/类
@Test
public void testPojoRoutes() throws Exception {
JndiContext jndctx = new JndiContext();
jndctx.bind("bye", new SayService("Good Bye!"));
CamelContext camelContext = new DefaultCamelContext(jndctx);
camelContext.addRoutes(createRouteBuilder(camelContext));
camelContext.start();
try {
Endpoint endpoint = camelContext.getEndpoint("direct:hello");
ISay proxy = ProxyHelper.createProxy(endpoint, false, ISay.class);
String rc = proxy.say();
Assert.assertEquals("Good Bye!", rc);
} finally {
camelContext.stop();
}
}
示例3: createJndiContext
import org.apache.camel.util.jndi.JndiContext; //导入方法依赖的package包/类
@Override
protected Context createJndiContext() throws Exception {
JndiContext answer = new JndiContext();
// add ActiveMQ with embedded broker
ConnectionFactory connectionFactory = CamelJmsTestHelper.createConnectionFactory();
JmsComponent amq = jmsComponentAutoAcknowledge(connectionFactory);
amq.setCamelContext(context);
answer.bind("jms", amq);
return answer;
}
示例4: testPojoRoutes
import org.apache.camel.util.jndi.JndiContext; //导入方法依赖的package包/类
@Test
public void testPojoRoutes() throws Exception {
if (classPathHasSpaces()) {
return;
}
// Boot up a local RMI registry
LocateRegistry.createRegistry(getPort());
// START SNIPPET: register
JndiContext context = new JndiContext();
context.bind("bye", new SayService("Good Bye!"));
CamelContext camelContext = new DefaultCamelContext(context);
// END SNIPPET: register
camelContext.addRoutes(getRouteBuilder(camelContext));
camelContext.start();
// START SNIPPET: invoke
Endpoint endpoint = camelContext.getEndpoint("direct:hello");
ISay proxy = ProxyHelper.createProxy(endpoint, false, ISay.class);
String rc = proxy.say();
assertEquals("Good Bye!", rc);
// END SNIPPET: invoke
camelContext.stop();
}
示例5: createJndiContext
import org.apache.camel.util.jndi.JndiContext; //导入方法依赖的package包/类
@Override
protected Context createJndiContext() throws Exception {
JndiContext answer = new JndiContext();
answer.bind("myBean", myBean);
answer.bind("myOtherBean", myOtherBean);
return answer;
}
示例6: createJndiContext
import org.apache.camel.util.jndi.JndiContext; //导入方法依赖的package包/类
@Override
protected Context createJndiContext() throws Exception {
JndiContext answer = new JndiContext();
answer.bind("myBean", myBean);
// add ActiveMQ with embedded broker
ConnectionFactory connectionFactory = CamelJmsTestHelper.createConnectionFactory();
JmsComponent amq = jmsComponentAutoAcknowledge(connectionFactory);
amq.setCamelContext(context);
answer.bind("jms", amq);
return answer;
}
示例7: createJndiContext
import org.apache.camel.util.jndi.JndiContext; //导入方法依赖的package包/类
protected Context createJndiContext() throws Exception {
JndiContext answer = new JndiContext();
answer.bind("foo", new FooBean());
answer.bind("bar", new BarBean());
answer.bind("baz", new BazBean());
return answer;
}
示例8: testCamelForBean
import org.apache.camel.util.jndi.JndiContext; //导入方法依赖的package包/类
/**
* Camel简单入门
* @throws Exception
*/
@Test
public void testCamelForBean() throws Exception {
JndiContext context = new JndiContext();
CamelLeaveBean leave = new CamelLeaveBean();
context.bind("leave", leave);
CamelContext camelContext = new DefaultCamelContext(context);
camelContext.addRoutes(new CamelLeaveRoute());
camelContext.start();
ProducerTemplate tpl = camelContext.createProducerTemplate();
// true
tpl.sendBody("direct:start", Collections.singletonMap("days", 2));
assertFalse(leave.getResult());
// false
tpl.sendBody("direct:start", Collections.singletonMap("days", 5));
assertTrue(leave.getResult());
// Set<LeaveBean> byType = camelContext.getRegistry().findByType(LeaveBean.class);
// System.out.println("aa=" + ((LeaveBean)byType.iterator().next()).getResult());
/*tpl.sendBody("direct:forProperty", Collections.singletonMap("days", 2));
String result = System.getProperty("ok");
assertEquals("false", result);
tpl.sendBody("direct:forProperty", Collections.singletonMap("days", 5));
result = System.getProperty("ok");
assertEquals("true", result);*/
camelContext.stop();
}
示例9: createJndiContext
import org.apache.camel.util.jndi.JndiContext; //导入方法依赖的package包/类
@Override
protected Context createJndiContext() throws Exception {
JndiContext answer = new JndiContext();
answer.bind("addTime", new TimerBean());
return answer;
}
示例10: createJndiContext
import org.apache.camel.util.jndi.JndiContext; //导入方法依赖的package包/类
@Override
protected Context createJndiContext() throws Exception {
jndiContext = new JndiContext();
jndiContext.bind("myBean", new MyBean());
return jndiContext;
}
示例11: createJndiContext
import org.apache.camel.util.jndi.JndiContext; //导入方法依赖的package包/类
@Override
protected Context createJndiContext() throws Exception {
JndiContext answer = new JndiContext();
answer.bind("myBean", myBean);
return answer;
}
示例12: createJndiContext
import org.apache.camel.util.jndi.JndiContext; //导入方法依赖的package包/类
@Override
protected Context createJndiContext() throws Exception {
JndiContext answer = new JndiContext();
answer.bind("myBean", new MyBean());
return answer;
}
示例13: createJndiContext
import org.apache.camel.util.jndi.JndiContext; //导入方法依赖的package包/类
protected Context createJndiContext() throws Exception {
JndiContext answer = new JndiContext();
answer.bind("foo", new MyBean("foo"));
answer.bind("bar", new MyBean("bar"));
return answer;
}
示例14: createJndiContext
import org.apache.camel.util.jndi.JndiContext; //导入方法依赖的package包/类
protected Context createJndiContext() throws Exception {
JndiContext answer = new JndiContext();
answer.bind("myBean", new MyBean());
return answer;
}
示例15: createJndiContext
import org.apache.camel.util.jndi.JndiContext; //导入方法依赖的package包/类
protected Context createJndiContext() throws Exception {
JndiContext answer = new JndiContext();
answer.bind("processor", new AttachmentProcessor());
return answer;
}