当前位置: 首页>>代码示例>>Java>>正文


Java ServiceHelper.startServices方法代码示例

本文整理汇总了Java中org.apache.camel.util.ServiceHelper.startServices方法的典型用法代码示例。如果您正苦于以下问题:Java ServiceHelper.startServices方法的具体用法?Java ServiceHelper.startServices怎么用?Java ServiceHelper.startServices使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.apache.camel.util.ServiceHelper的用法示例。


在下文中一共展示了ServiceHelper.startServices方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: setUp

import org.apache.camel.util.ServiceHelper; //导入方法依赖的package包/类
@Before
public void setUp() throws Exception {
    camelContext = new DefaultCamelContext();
    SimpleRegistry registry = new SimpleRegistry();
    Map<String, Object> params = new HashMap<String, Object>();
    params.put("custName", "Willem");
    // bind the params
    registry.put("params", params);
    camelContext.setRegistry(registry);
    
    template = camelContext.createProducerTemplate();
    ServiceHelper.startServices(template, camelContext);

    Endpoint value = camelContext.getEndpoint(getEndpointUri());
    assertNotNull("Could not find endpoint!", value);
    assertTrue("Should be a JPA endpoint but was: " + value, value instanceof JpaEndpoint);
    endpoint = (JpaEndpoint)value;

    transactionTemplate = endpoint.createTransactionTemplate();
    entityManager = endpoint.createEntityManager();
}
 
开发者ID:HydAu,项目名称:Camel,代码行数:22,代码来源:JpaWithNamedQueryAndParametersTest.java

示例2: setUp

import org.apache.camel.util.ServiceHelper; //导入方法依赖的package包/类
@Override
@Before
protected void setUp() throws Exception {
    super.setUp();

    context2 = new DefaultCamelContext();
    template2 = context2.createProducerTemplate();

    ServiceHelper.startServices(template2, context2);

    // add routes after CamelContext has been started
    RouteBuilder routeBuilder = createRouteBuilderForSecondContext();
    if (routeBuilder != null) {
        context2.addRoutes(routeBuilder);
    }
}
 
开发者ID:HydAu,项目名称:Camel,代码行数:17,代码来源:AbstractDirectVmTestSupport.java

示例3: doStart

import org.apache.camel.util.ServiceHelper; //导入方法依赖的package包/类
@Override
protected void doStart() throws Exception {
    // inject CamelContext before starting
    if (jsonMarshal instanceof CamelContextAware) {
        ((CamelContextAware) jsonMarshal).setCamelContext(camelContext);
    }
    if (jsonUnmarshal instanceof CamelContextAware) {
        ((CamelContextAware) jsonUnmarshal).setCamelContext(camelContext);
    }
    if (xmlMarshal instanceof CamelContextAware) {
        ((CamelContextAware) xmlMarshal).setCamelContext(camelContext);
    }
    if (xmlUnmarshal instanceof CamelContextAware) {
        ((CamelContextAware) xmlUnmarshal).setCamelContext(camelContext);
    }
    ServiceHelper.startServices(jsonMarshal, jsonUnmarshal, xmlMarshal, xmlUnmarshal);
}
 
开发者ID:HydAu,项目名称:Camel,代码行数:18,代码来源:RestBindingProcessor.java

示例4: doStart

import org.apache.camel.util.ServiceHelper; //导入方法依赖的package包/类
@Override
protected void doStart() throws Exception {
    if (binding == null) {
        binding = CamelContextHelper.mandatoryLookup(getCamelContext(), bindingName, Binding.class);
    }
    if (delegate == null) {
        delegate = getMandatoryEndpoint(getCamelContext(), delegateUri);
    }

    // inject CamelContext
    if (binding instanceof CamelContextAware) {
        ((CamelContextAware) binding).setCamelContext(getCamelContext());
    }
    ServiceHelper.startServices(delegate, binding);
    super.doStart();
}
 
开发者ID:HydAu,项目名称:Camel,代码行数:17,代码来源:BindingEndpoint.java

示例5: doStart

import org.apache.camel.util.ServiceHelper; //导入方法依赖的package包/类
protected void doStart() throws Exception {
    if (aggregationStrategy == null) {
        aggregationStrategy = defaultAggregationStrategy();
    }

    if (producerCache == null) {
        if (cacheSize < 0) {
            producerCache = new EmptyProducerCache(this, camelContext);
            LOG.debug("Enricher {} is not using ProducerCache", this);
        } else if (cacheSize == 0) {
            producerCache = new ProducerCache(this, camelContext);
            LOG.debug("Enricher {} using ProducerCache with default cache size", this);
        } else {
            producerCache = new ProducerCache(this, camelContext, cacheSize);
            LOG.debug("Enricher {} using ProducerCache with cacheSize={}", this, cacheSize);
        }
    }

    ServiceHelper.startServices(producerCache, aggregationStrategy);
}
 
开发者ID:HydAu,项目名称:Camel,代码行数:21,代码来源:Enricher.java

示例6: doStart

import org.apache.camel.util.ServiceHelper; //导入方法依赖的package包/类
@Override
protected void doStart() throws Exception {
    ServiceHelper.startServices(output, outputAsync, deadLetter);

    // determine if redeliver is enabled or not
    redeliveryEnabled = determineIfRedeliveryIsEnabled();
    if (log.isTraceEnabled()) {
        log.trace("Redelivery enabled: {} on error handler: {}", redeliveryEnabled, this);
    }

    // we only need thread pool if redelivery is enabled
    if (redeliveryEnabled) {
        if (executorService == null) {
            // use default shared executor service
            executorService = camelContext.getErrorHandlerExecutorService();
        }
        if (log.isDebugEnabled()) {
            log.debug("Using ExecutorService: {} for redeliveries on error handler: {}", executorService, this);
        }
    }

    // reset flag when starting
    preparingShutdown = false;
    redeliverySleepCounter.set(0);
}
 
开发者ID:HydAu,项目名称:Camel,代码行数:26,代码来源:RedeliveryErrorHandler.java

示例7: doStart

import org.apache.camel.util.ServiceHelper; //导入方法依赖的package包/类
@Override
protected void doStart() throws Exception {
    if (dataFormat == null && name != null) {
        dataFormat = getCamelContext().resolveDataFormat(name);
    }
    if (operation.equals("marshal")) {
        marshal = new MarshalProcessor(dataFormat);
        marshal.setCamelContext(getCamelContext());
    } else {
        unmarshal = new UnmarshalProcessor(dataFormat);
        unmarshal.setCamelContext(getCamelContext());
    }

    ServiceHelper.startServices(dataFormat, marshal, unmarshal);
    super.doStart();
}
 
开发者ID:HydAu,项目名称:Camel,代码行数:17,代码来源:DataFormatEndpoint.java

示例8: doStart

import org.apache.camel.util.ServiceHelper; //导入方法依赖的package包/类
@Override
protected void doStart() throws Exception {
    jsonMarshalEndpoint = getCamelContext().getEndpoint("dataformat:json-jackson:marshal");
    Objects.requireNonNull(jsonMarshalEndpoint, "jsonMarshalEndpoint");
    jsonMarshalProducer = jsonMarshalEndpoint.createProducer();
    Objects.requireNonNull(jsonMarshalProducer, "jsonMarshalProducer");
    ServiceHelper.startServices(jsonMarshalEndpoint, jsonMarshalProducer);
    super.doStart();
}
 
开发者ID:syndesisio,项目名称:syndesis,代码行数:10,代码来源:JsonEndpoint.java

示例9: doStart

import org.apache.camel.util.ServiceHelper; //导入方法依赖的package包/类
protected void doStart() throws Exception {
    ObjectHelper.notNull(configuration, "setNettyServerBootstrapConfiguration() must be called with a NettyServerBootstrapConfiguration instance", this);

    // port must be set
    if (configuration.getPort() <= 0) {
        throw new IllegalArgumentException("Port must be configured on NettySharedHttpServerBootstrapConfiguration " + configuration);
    }
    // hostname must be set
    if (ObjectHelper.isEmpty(configuration.getHost())) {
        throw new IllegalArgumentException("Host must be configured on NettySharedHttpServerBootstrapConfiguration " + configuration);
    }

    LOG.debug("NettySharedHttpServer using configuration: {}", configuration);

    // force using tcp as the underlying transport
    configuration.setProtocol("tcp");

    channelFactory = new HttpServerMultiplexChannelHandler();
    channelFactory.init(configuration.getPort());

    ChannelInitializer<Channel> pipelineFactory = new HttpServerSharedInitializerFactory(configuration, channelFactory, classResolver);

    // thread factory and pattern
    String port = Matcher.quoteReplacement("" + configuration.getPort());
    String pattern = threadPattern;
    pattern = pattern.replaceFirst("#port#", port);
    ThreadFactory tf = new CamelThreadFactory(pattern, "NettySharedHttpServer", true);

    // create bootstrap factory and disable compatible check as its shared among the consumers
    bootstrapFactory = new HttpServerBootstrapFactory(channelFactory, false);
    bootstrapFactory.init(tf, configuration, pipelineFactory);

    ServiceHelper.startServices(channelFactory);

    if (startServer) {
        LOG.info("Starting NettySharedHttpServer on {}:{}", configuration.getHost(), configuration.getPort());
        ServiceHelper.startServices(bootstrapFactory);
    }
}
 
开发者ID:HydAu,项目名称:Camel,代码行数:40,代码来源:DefaultNettySharedHttpServer.java

示例10: doStart

import org.apache.camel.util.ServiceHelper; //导入方法依赖的package包/类
protected void doStart() throws Exception {
    if (extendedStatistics) {
        int max = maxCacheSize == 0 ? CamelContextHelper.getMaximumCachePoolSize(camelContext) : maxCacheSize;
        statistics = new DefaultEndpointUtilizationStatistics(max);
    }

    ServiceHelper.startServices(consumers.values());
}
 
开发者ID:HydAu,项目名称:Camel,代码行数:9,代码来源:ConsumerCache.java

示例11: setUp

import org.apache.camel.util.ServiceHelper; //导入方法依赖的package包/类
public void setUp() throws Exception {
    super.setUp();
    context.setUseMDCLogging(true);

    context2 = new DefaultCamelContext();
    context2.setUseMDCLogging(true);
    template2 = context2.createProducerTemplate();
    ServiceHelper.startServices(template2, context2);

    // add routes after CamelContext has been started
    context2.addRoutes(createRouteBuilder2());
}
 
开发者ID:HydAu,项目名称:Camel,代码行数:13,代码来源:AbstractDistributedTest.java

示例12: doStart

import org.apache.camel.util.ServiceHelper; //导入方法依赖的package包/类
protected void doStart() throws Exception {
    ObjectHelper.notNull(configuration, "setNettyServerBootstrapConfiguration() must be called with a NettyServerBootstrapConfiguration instance", this);

    // port must be set
    if (configuration.getPort() <= 0) {
        throw new IllegalArgumentException("Port must be configured on NettySharedHttpServerBootstrapConfiguration " + configuration);
    }
    // hostname must be set
    if (ObjectHelper.isEmpty(configuration.getHost())) {
        throw new IllegalArgumentException("Host must be configured on NettySharedHttpServerBootstrapConfiguration " + configuration);
    }

    LOG.debug("NettySharedHttpServer using configuration: {}", configuration);

    // force using tcp as the underlying transport
    configuration.setProtocol("tcp");

    channelFactory = new HttpServerMultiplexChannelHandler();
    channelFactory.init(configuration.getPort());

    ChannelPipelineFactory pipelineFactory = new HttpServerSharedPipelineFactory(configuration, channelFactory, classResolver);

    // thread factory and pattern
    String port = Matcher.quoteReplacement("" + configuration.getPort());
    String pattern = threadPattern;
    pattern = pattern.replaceFirst("#port#", port);
    ThreadFactory tf = new CamelThreadFactory(pattern, "NettySharedHttpServer", true);

    // create bootstrap factory and disable compatible check as its shared among the consumers
    bootstrapFactory = new HttpServerBootstrapFactory(channelFactory, false);
    bootstrapFactory.init(tf, configuration, pipelineFactory);

    ServiceHelper.startServices(channelFactory);

    if (startServer) {
        LOG.info("Starting NettySharedHttpServer on {}:{}", configuration.getHost(), configuration.getPort());
        ServiceHelper.startServices(bootstrapFactory);
    }
}
 
开发者ID:HydAu,项目名称:Camel,代码行数:40,代码来源:DefaultNettySharedHttpServer.java

示例13: setUp

import org.apache.camel.util.ServiceHelper; //导入方法依赖的package包/类
@Override
@Before
protected void setUp() throws Exception {
    super.setUp();
    context2 = new DefaultCamelContext();
    template2 = context2.createProducerTemplate();
    
    ServiceHelper.startServices(template2, context2);

    // add routes after CamelContext has been started
    RouteBuilder routeBuilder = createRouteBuilderForSecondContext();
    if (routeBuilder != null) {
        context2.addRoutes(routeBuilder);
    }
}
 
开发者ID:HydAu,项目名称:Camel,代码行数:16,代码来源:AbstractVmTestSupport.java

示例14: setUp

import org.apache.camel.util.ServiceHelper; //导入方法依赖的package包/类
@Before
public void setUp() throws Exception {
    template = camelContext.createProducerTemplate();
    ServiceHelper.startServices(template, camelContext);

    Endpoint value = camelContext.getEndpoint(getEndpointUri());
    assertNotNull("Could not find endpoint!", value);
    assertTrue("Should be a JPA endpoint but was: " + value, value instanceof JpaEndpoint);
    endpoint = (JpaEndpoint)value;

    transactionTemplate = endpoint.createTransactionTemplate();
    entityManager = endpoint.createEntityManager();
}
 
开发者ID:HydAu,项目名称:Camel,代码行数:14,代码来源:JpaWithNamedQueryTest.java

示例15: doStart

import org.apache.camel.util.ServiceHelper; //导入方法依赖的package包/类
@Override
protected void doStart() throws Exception {
    super.doStart();

    LOG.debug("Netty consumer binding to: {}", configuration.getAddress());

    if (nettyServerBootstrapFactory == null) {
        // setup pipeline factory
        ServerPipelineFactory pipelineFactory;
        ServerPipelineFactory factory = configuration.getServerPipelineFactory();
        if (factory != null) {
            pipelineFactory = factory.createPipelineFactory(this);
        } else {
            pipelineFactory = new DefaultServerPipelineFactory(this);
        }

        if (isTcp()) {
            if (configuration.isClientMode()) {
                nettyServerBootstrapFactory = new ClientModeTCPNettyServerBootstrapFactory();
            } else {
                nettyServerBootstrapFactory = new SingleTCPNettyServerBootstrapFactory();
            }
        } else {
            nettyServerBootstrapFactory = new SingleUDPNettyServerBootstrapFactory();
        }
        nettyServerBootstrapFactory.init(context, configuration, pipelineFactory);
    }

    ServiceHelper.startServices(nettyServerBootstrapFactory);

    LOG.info("Netty consumer bound to: " + configuration.getAddress());
}
 
开发者ID:HydAu,项目名称:Camel,代码行数:33,代码来源:NettyConsumer.java


注:本文中的org.apache.camel.util.ServiceHelper.startServices方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。