本文整理汇总了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;
}
示例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;
}
示例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");
}
示例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;
}
示例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);
}
示例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());
}
示例7: PollingConsumerSupport
import org.apache.camel.Endpoint; //导入方法依赖的package包/类
public PollingConsumerSupport(Endpoint endpoint) {
this.endpoint = endpoint;
this.exceptionHandler = new LoggingExceptionHandler(endpoint.getCamelContext(), getClass());
}
示例8: DefaultExchange
import org.apache.camel.Endpoint; //导入方法依赖的package包/类
public DefaultExchange(Endpoint fromEndpoint, ExchangePattern pattern) {
this(fromEndpoint.getCamelContext(), pattern);
this.fromEndpoint = fromEndpoint;
}
示例9: createMethodInfoCache
import org.apache.camel.Endpoint; //导入方法依赖的package包/类
protected static MethodInfoCache createMethodInfoCache(Endpoint endpoint) {
return new MethodInfoCache(endpoint.getCamelContext());
}