本文整理汇总了Java中org.apache.camel.support.ServiceSupport类的典型用法代码示例。如果您正苦于以下问题:Java ServiceSupport类的具体用法?Java ServiceSupport怎么用?Java ServiceSupport使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ServiceSupport类属于org.apache.camel.support包,在下文中一共展示了ServiceSupport类的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: testBadLogin
import org.apache.camel.support.ServiceSupport; //导入依赖的package包/类
@Test
public void testBadLogin() throws Exception {
getMockEndpoint("mock:result").expectedMessageCount(0);
assertTrue(latch.await(5, TimeUnit.SECONDS));
assertMockEndpointsSatisfied();
// consumer should be stopped
Thread.sleep(1000);
Consumer consumer = context.getRoute("foo").getConsumer();
assertTrue("Consumer should be stopped", ((ServiceSupport)consumer).isStopped());
}
开发者ID:HydAu,项目名称:Camel,代码行数:15,代码来源:FtpConsumerThrowExceptionOnLoginFailedTest.java
示例2: onJobExecute
import org.apache.camel.support.ServiceSupport; //导入依赖的package包/类
/**
* This method is invoked when a Quartz job is fired.
*
* @param jobExecutionContext the Quartz Job context
*/
public void onJobExecute(final JobExecutionContext jobExecutionContext) throws JobExecutionException {
boolean run = true;
LoadBalancer balancer = getLoadBalancer();
if (balancer instanceof ServiceSupport) {
run = ((ServiceSupport) balancer).isRunAllowed();
}
if (!run) {
// quartz scheduler could potential trigger during a route has been shutdown
LOG.warn("Cannot execute Quartz Job with context: " + jobExecutionContext + " because processor is not started: " + balancer);
return;
}
LOG.debug("Firing Quartz Job with context: {}", jobExecutionContext);
Exchange exchange = createExchange(jobExecutionContext);
try {
balancer.process(exchange);
if (exchange.getException() != null) {
// propagate the exception back to Quartz
throw new JobExecutionException(exchange.getException());
}
} catch (Exception e) {
// log the error
LOG.error(CamelExchangeException.createExceptionMessage("Error processing exchange", exchange, e));
// and rethrow to let quartz handle it
if (e instanceof JobExecutionException) {
throw (JobExecutionException) e;
}
throw new JobExecutionException(e);
}
}
开发者ID:HydAu,项目名称:Camel,代码行数:39,代码来源:QuartzEndpoint.java
示例3: testEndpointRegistryStopRouteEndpoints
import org.apache.camel.support.ServiceSupport; //导入依赖的package包/类
public void testEndpointRegistryStopRouteEndpoints() throws Exception {
Endpoint seda = context.hasEndpoint("seda://foo");
assertNotNull(seda);
Endpoint log = context.hasEndpoint("log://bar");
assertNotNull(log);
assertTrue("Should be started", ((ServiceSupport) seda).isStarted());
assertTrue("Should be started", ((ServiceSupport) log).isStarted());
assertTrue(context.hasEndpoint("seda:foo") != null);
assertTrue(context.hasEndpoint("seda:bar") != null);
assertTrue(context.hasEndpoint("log://foo") != null);
assertTrue(context.hasEndpoint("log://bar") != null);
assertTrue(context.hasEndpoint("mock://result") != null);
assertTrue(context.hasEndpoint("seda://stop") != null);
assertTrue(context.hasEndpoint("mock://stop") != null);
// stop and remove bar route
context.stopRoute("bar");
context.removeRoute("bar");
assertTrue(context.hasEndpoint("seda://foo") != null);
assertTrue(context.hasEndpoint("log://foo") != null);
assertFalse(context.hasEndpoint("seda://bar") != null);
assertFalse(context.hasEndpoint("log://bar") != null);
assertTrue(context.hasEndpoint("mock://result") != null);
assertTrue(context.hasEndpoint("seda://stop") != null);
assertTrue(context.hasEndpoint("mock://stop") != null);
assertTrue("Should be started", ((ServiceSupport) seda).isStarted());
assertTrue("Should be stopped", ((ServiceSupport) log).isStopped());
// stop and remove baz route
context.stopRoute("baz");
context.removeRoute("baz");
assertTrue(context.hasEndpoint("seda://foo") != null);
assertTrue(context.hasEndpoint("log://foo") != null);
assertFalse(context.hasEndpoint("seda://bar") != null);
assertFalse(context.hasEndpoint("log://bar") != null);
assertTrue(context.hasEndpoint("mock://result") != null);
assertFalse(context.hasEndpoint("seda://stop") != null);
assertFalse(context.hasEndpoint("mock://stop") != null);
// stop and remove foo route
context.stopRoute("foo");
context.removeRoute("foo");
assertFalse(context.hasEndpoint("seda://foo") != null);
assertFalse(context.hasEndpoint("log://foo") != null);
assertFalse(context.hasEndpoint("seda://bar") != null);
assertFalse(context.hasEndpoint("log://bar") != null);
assertFalse(context.hasEndpoint("mock://result") != null);
assertFalse(context.hasEndpoint("seda://stop") != null);
assertFalse(context.hasEndpoint("mock://stop") != null);
assertFalse("Should not be started", ((ServiceSupport) seda).isStarted());
assertFalse("Should not be started", ((ServiceSupport) log).isStarted());
}
开发者ID:HydAu,项目名称:Camel,代码行数:58,代码来源:RemoveRouteStopEndpointTest.java
示例4: testEndpointRegistryStopRouteEndpointsContextStop
import org.apache.camel.support.ServiceSupport; //导入依赖的package包/类
public void testEndpointRegistryStopRouteEndpointsContextStop() throws Exception {
Endpoint seda = context.hasEndpoint("seda://foo");
assertNotNull(seda);
Endpoint log = context.hasEndpoint("log://bar");
assertNotNull(log);
assertTrue("Should be started", ((ServiceSupport) seda).isStarted());
assertTrue("Should be started", ((ServiceSupport) log).isStarted());
assertTrue(context.hasEndpoint("seda://foo") != null);
assertTrue(context.hasEndpoint("log://foo") != null);
assertTrue(context.hasEndpoint("seda://bar") != null);
assertTrue(context.hasEndpoint("log://bar") != null);
assertTrue(context.hasEndpoint("mock://result") != null);
assertTrue(context.hasEndpoint("seda://stop") != null);
assertTrue(context.hasEndpoint("mock://stop") != null);
// stop and remove bar route
context.stopRoute("bar");
context.removeRoute("bar");
assertTrue("Should be started", ((ServiceSupport) seda).isStarted());
assertTrue("Should be stopped", ((ServiceSupport) log).isStopped());
assertTrue(context.hasEndpoint("seda:foo") != null);
assertTrue(context.hasEndpoint("log://foo") != null);
assertFalse(context.hasEndpoint("seda://bar") != null);
assertFalse(context.hasEndpoint("log://bar") != null);
assertTrue(context.hasEndpoint("mock://result") != null);
assertTrue(context.hasEndpoint("seda://stop") != null);
assertTrue(context.hasEndpoint("mock://stop") != null);
// stop and remove baz route
context.stopRoute("baz");
context.removeRoute("baz");
assertTrue(context.hasEndpoint("seda://foo") != null);
assertTrue(context.hasEndpoint("log://foo") != null);
assertFalse(context.hasEndpoint("seda://bar") != null);
assertFalse(context.hasEndpoint("log://bar") != null);
assertTrue(context.hasEndpoint("mock://result") != null);
assertFalse(context.hasEndpoint("seda://stop") != null);
assertFalse(context.hasEndpoint("mock://stop") != null);
// stop camel which should stop the endpoint
context.stop();
assertFalse("Should not be started", ((ServiceSupport) seda).isStarted());
assertFalse("Should not be started", ((ServiceSupport) log).isStarted());
}
开发者ID:HydAu,项目名称:Camel,代码行数:51,代码来源:RemoveRouteStopEndpointTest.java
注:本文中的org.apache.camel.support.ServiceSupport类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论