當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。