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


Java Endpoint.getCamelContext方法代码示例

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


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

示例1: lookupEndpointRegistryId

import org.apache.camel.Endpoint; //导入方法依赖的package包/类
/**
 * Lookup the id the given endpoint has been enlisted with in the {@link org.apache.camel.spi.Registry}.
 *
 * @param endpoint the endpoint
 * @return the endpoint id, or <tt>null</tt> if not found
 */
public static String lookupEndpointRegistryId(Endpoint endpoint) {
    if (endpoint == null || endpoint.getCamelContext() == null) {
        return null;
    }

    // it may be a delegate endpoint, which we need to match as well
    Endpoint delegate = null;
    if (endpoint instanceof DelegateEndpoint) {
        delegate = ((DelegateEndpoint) endpoint).getEndpoint();
    }

    Map<String, Endpoint> map = endpoint.getCamelContext().getRegistry().findByTypeWithName(Endpoint.class);
    for (Map.Entry<String, Endpoint> entry : map.entrySet()) {
        if (entry.getValue().equals(endpoint) || entry.getValue().equals(delegate)) {
            return entry.getKey();
        }
    }

    // not found
    return null;
}
 
开发者ID:HydAu,项目名称:Camel,代码行数:28,代码来源:EndpointHelper.java

示例2: createInjectionProducerTemplate

import org.apache.camel.Endpoint; //导入方法依赖的package包/类
/**
 * Factory method to create a {@link org.apache.camel.ProducerTemplate} to be injected into a POJO
 */
protected ProducerTemplate createInjectionProducerTemplate(String endpointUri, String endpointRef, String endpointProperty,
                                                           String injectionPointName, Object bean) {
    // endpoint is optional for this injection point
    Endpoint endpoint = getEndpointInjection(bean, endpointUri, endpointRef, endpointProperty, injectionPointName, false);
    CamelContext context = endpoint != null ? endpoint.getCamelContext() : getCamelContext();
    ProducerTemplate answer = new DefaultProducerTemplate(context, endpoint);
    // start the template so its ready to use
    try {
        // no need to defer the template as it can adjust to the endpoint at runtime
        startService(answer, context, bean, null);
    } catch (Exception e) {
        throw ObjectHelper.wrapRuntimeCamelException(e);
    }
    return answer;
}
 
开发者ID:HydAu,项目名称:Camel,代码行数:19,代码来源:CamelPostProcessorHelper.java

示例3: SendProcessor

import org.apache.camel.Endpoint; //导入方法依赖的package包/类
public SendProcessor(Endpoint destination, ExchangePattern pattern) {
    ObjectHelper.notNull(destination, "destination");
    this.destination = destination;
    this.camelContext = destination.getCamelContext();
    this.pattern = pattern;
    try {
        this.destinationExchangePattern = null;
        this.destinationExchangePattern = EndpointHelper.resolveExchangePatternFromUrl(destination.getEndpointUri());
    } catch (URISyntaxException e) {
        throw ObjectHelper.wrapRuntimeCamelException(e);
    }
    ObjectHelper.notNull(this.camelContext, "camelContext");
}
 
开发者ID:HydAu,项目名称:Camel,代码行数:14,代码来源:SendProcessor.java

示例4: getRouteIdFromEndpoint

import org.apache.camel.Endpoint; //导入方法依赖的package包/类
/**
 * Gets the route id for the given endpoint in which there is a consumer listening.
 *
 * @param endpoint the endpoint
 * @return the route id, or <tt>null</tt> if none found
 */
public static String getRouteIdFromEndpoint(Endpoint endpoint) {
    if (endpoint == null || endpoint.getCamelContext() == null) {
        return null;
    }

    List<Route> routes = endpoint.getCamelContext().getRoutes();
    for (Route route : routes) {
        if (route.getEndpoint().equals(endpoint)
                || route.getEndpoint().getEndpointKey().equals(endpoint.getEndpointKey())) {
            return route.getId();
        }
    }
    return null;
}
 
开发者ID:HydAu,项目名称:Camel,代码行数:21,代码来源:EndpointHelper.java

示例5: EventDrivenPollingConsumer

import org.apache.camel.Endpoint; //导入方法依赖的package包/类
public EventDrivenPollingConsumer(Endpoint endpoint, int queueSize) {
    super(endpoint);
    this.queueCapacity = queueSize;
    if (queueSize <= 0) {
        this.queue = new LinkedBlockingQueue<Exchange>();
    } else {
        this.queue = new ArrayBlockingQueue<Exchange>(queueSize);
    }
    this.interruptedExceptionHandler = new LoggingExceptionHandler(endpoint.getCamelContext(), EventDrivenPollingConsumer.class);
}
 
开发者ID:HydAu,项目名称:Camel,代码行数:11,代码来源:EventDrivenPollingConsumer.java

示例6: DefaultConsumer

import org.apache.camel.Endpoint; //导入方法依赖的package包/类
public DefaultConsumer(Endpoint endpoint, Processor processor) {
    this.endpoint = endpoint;
    this.processor = processor;
    this.exceptionHandler = new LoggingExceptionHandler(endpoint.getCamelContext(), getClass());
}
 
开发者ID:HydAu,项目名称:Camel,代码行数:6,代码来源:DefaultConsumer.java

示例7: PollingConsumerSupport

import org.apache.camel.Endpoint; //导入方法依赖的package包/类
public PollingConsumerSupport(Endpoint endpoint) {
    this.endpoint = endpoint;
    this.exceptionHandler = new LoggingExceptionHandler(endpoint.getCamelContext(), getClass());
}
 
开发者ID:HydAu,项目名称:Camel,代码行数:5,代码来源:PollingConsumerSupport.java

示例8: DefaultExchange

import org.apache.camel.Endpoint; //导入方法依赖的package包/类
public DefaultExchange(Endpoint fromEndpoint, ExchangePattern pattern) {
    this(fromEndpoint.getCamelContext(), pattern);
    this.fromEndpoint = fromEndpoint;
}
 
开发者ID:HydAu,项目名称:Camel,代码行数:5,代码来源:DefaultExchange.java

示例9: createMethodInfoCache

import org.apache.camel.Endpoint; //导入方法依赖的package包/类
protected static MethodInfoCache createMethodInfoCache(Endpoint endpoint) {
    return new MethodInfoCache(endpoint.getCamelContext());
}
 
开发者ID:HydAu,项目名称:Camel,代码行数:4,代码来源:ProxyHelper.java


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