本文整理汇总了Java中org.apache.camel.spring.Main.setApplicationContextUri方法的典型用法代码示例。如果您正苦于以下问题:Java Main.setApplicationContextUri方法的具体用法?Java Main.setApplicationContextUri怎么用?Java Main.setApplicationContextUri使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.apache.camel.spring.Main
的用法示例。
在下文中一共展示了Main.setApplicationContextUri方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: startCamel
import org.apache.camel.spring.Main; //导入方法依赖的package包/类
protected void startCamel() throws Exception {
if (!"true".equalsIgnoreCase(System.getProperty("skipStartingCamelContext"))) {
main = new Main();
main.setApplicationContextUri("META-INF/spring/camel-config.xml");
main.start();
} else {
System.out.println("Skipping starting CamelContext as system property skipStartingCamelContext is set to be true.");
}
}
示例2: boot
import org.apache.camel.spring.Main; //导入方法依赖的package包/类
protected void boot() throws Exception
{
// create a Main instance
main = new Main();
// enable hangup support so you can press ctrl + c to terminate the JVM
main.enableHangupSupport();
// Get spring definition of the routes to start
String uri = System.getProperty("boundary.application.context.uri");
LOG.info("Loading application context from: " + uri);
// Set the application context that configures the camel routes
main.setApplicationContextUri(uri);
// run until you terminate the JVM
LOG.info("Starting Web Hook");
main.run();
}
示例3: boot
import org.apache.camel.spring.Main; //导入方法依赖的package包/类
/**
* Starts a camel application context
*
* @throws Exception Upon any error
*/
protected void boot() throws Exception
{
// create a Main instance
main = new Main();
// enable hangup support so you can press ctrl + c to terminate the JVM
main.enableHangupSupport();
// Get spring definition of the routes to start
LOG.info("Loading application context from: " + uri);
// Set the application context that configures the camel routes
main.setApplicationContextUri(uri);
// run until you terminate the JVM
LOG.info("Starting {}",this.name);
main.run();
}
示例4: boot
import org.apache.camel.spring.Main; //导入方法依赖的package包/类
protected void boot() throws Exception
{
// create a Main instance
main = new Main();
// enable hangup support so you can press ctrl + c to terminate the JVM
main.enableHangupSupport();
// Get spring definition of the routes to start
String uri = System.getProperty("boundary.application.context.uri");
LOG.info("Loading application context from: " + uri);
// Set the application context that configures the camel routes
main.setApplicationContextUri(uri);
// run until you terminate the JVM
LOG.info("Starting Boundary Event SDK.");
main.run();
}
示例5: boot
import org.apache.camel.spring.Main; //导入方法依赖的package包/类
protected void boot() throws Exception
{
// create a Main instance
main = new Main();
// enable hangup support so you can press ctrl + c to terminate the JVM
main.enableHangupSupport();
// Get spring definition of the routes to start
String uri = System.getProperty("boundary.application.context.uri");
LOG.info("Loading application context from: " + uri);
// Set the application context that configures the camel routes
main.setApplicationContextUri(uri);
// run until you terminate the JVM
LOG.info("Starting Web Hook");
main.run();
}
示例6: testJaxrsRelayRoute
import org.apache.camel.spring.Main; //导入方法依赖的package包/类
/**
* That test builds a route chaining two cxfrs endpoints. It shows a request
* sent to the first one will be correctly transferred and consumed by the
* other one.
*/
@Test
public void testJaxrsRelayRoute() throws Exception {
final Main main = new Main();
try {
main.setApplicationContextUri("org/apache/camel/component/cxf/jaxrs/CxfRsSpringRelay.xml");
main.start();
Thread t = new Thread(new Runnable() {
/**
* Sends a request to the first endpoint in the route
*/
public void run() {
try {
JAXRSClientFactory.create("http://localhost:" + port6 + "/CxfRsRelayTest/rest", UploadService.class)
.upload(CamelRouteBuilder.class.getResourceAsStream(SAMPLE_CONTENT_PATH),
SAMPLE_NAME);
} catch (Exception e) {
log.warn("Error uploading to http://localhost:" + port6 + "/CxfRsRelayTest/rest", e);
}
}
});
t.start();
LATCH.await(10, TimeUnit.SECONDS);
assertEquals(SAMPLE_NAME, name);
StringWriter writer = new StringWriter();
IOUtils.copyAndCloseInput(new InputStreamReader(CamelRouteBuilder.class
.getResourceAsStream(SAMPLE_CONTENT_PATH)), writer);
assertEquals(writer.toString(), content);
} finally {
main.stop();
}
}
示例7: testApplicationContextFailed
import org.apache.camel.spring.Main; //导入方法依赖的package包/类
public void testApplicationContextFailed() {
try {
Main main = new Main();
main.setApplicationContextUri("org/apache/camel/spring/issues/MisspelledRouteRefTest.xml");
main.start();
fail("Should have thrown an exception");
} catch (Exception e) {
//expected but want to see what it looks like...
LOG.debug("Exception message : " + e.getMessage());
CamelException cause = (CamelException) e.getCause();
assertEquals("Cannot find any routes with this RouteBuilder reference: RouteBuilderRef[xxxroute]", cause.getMessage());
}
}