org.apache.camel.Route.getEndpoint()方法的使用及代码示例

x33g5p2x  于2022-01-29 转载在 其他  
字(7.4k)|赞(0)|评价(0)|浏览(73)

本文整理了Java中org.apache.camel.Route.getEndpoint方法的一些代码示例,展示了Route.getEndpoint的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Route.getEndpoint方法的具体详情如下:
包路径:org.apache.camel.Route
类名称:Route
方法名:getEndpoint

Route.getEndpoint介绍

暂无

代码示例

代码示例来源:origin: org.apache.camel/camel-zipkin

@Override
public void onExchangeBegin(Route route, Exchange exchange) {
  // use route policy to track events when Camel a Camel route begins/end the lifecycle of an Exchange
  // these events corresponds to Zipkin server events
  String serviceName = getServiceName(exchange, route.getEndpoint(), true, false);
  Tracing brave = getTracing(serviceName);
  if (brave != null) {
    serverRequest(brave, serviceName, exchange);
  }
 
}

代码示例来源:origin: org.apache.camel/camel-zipkin

@Override
  public void onExchangeDone(Route route, Exchange exchange) {
    String serviceName = getServiceName(exchange, route.getEndpoint(), true, false);
    Tracing brave = getTracing(serviceName);
    if (brave != null) {
      serverResponse(brave, serviceName, exchange);
    }
  }
}

代码示例来源:origin: org.apache.camel/camel-zookeeper-master

protected Runnable onDisconnected() {
  return () -> {
    masterConsumer.set(false);
    try {
      stopConsumer(route.getConsumer());
    } catch (Exception e) {
      log.warn("Failed to stop master consumer: {}", route.getEndpoint(), e);
    }
  };
}

代码示例来源:origin: org.apache.camel/camel-quartz2

private void ensureNoDupTriggerKey() {
  for (Route route : getCamelContext().getRoutes()) {
    if (route.getEndpoint() instanceof QuartzEndpoint) {
      QuartzEndpoint quartzEndpoint = (QuartzEndpoint) route.getEndpoint();
      TriggerKey checkTriggerKey = quartzEndpoint.getTriggerKey();
      if (triggerKey.equals(checkTriggerKey)) {
        throw new IllegalArgumentException("Trigger key " + triggerKey + " is already in use by " + quartzEndpoint);
      }
    }
  }
}

代码示例来源:origin: org.apache.camel/camel-zookeeper-master

protected Runnable onLockOwned() {
  return () -> {
    if (masterConsumer.compareAndSet(false, true)) {
      try {
        // ensure endpoint is also started
        log.info("Elected as master. Starting consumer: {}", route.getEndpoint());
        startConsumer(route.getConsumer());
        // Lets show we are starting the consumer.
        thisNodeState = createNodeState();
        thisNodeState.setStarted(true);
        groupListener.updateState(thisNodeState);
      } catch (Exception e) {
        log.error("Failed to start master consumer for: {}", route.getEndpoint(), e);
      }
      log.info("Elected as master. Consumer started: {}", route.getEndpoint());
    }
  };
}

代码示例来源:origin: wildfly-extras/wildfly-camel

public void onRoutesAdd(Collection<Route> routes) {
  /*
   * LifecycleStrategySupport.onEndpointAdd() is not called for CxfRsEndpoints created via direct constructor
   * invocation. Therefore we check if the buses on CxfRsEndpoints are correct.
   */
  for (Route route : routes) {
    final Endpoint endpoint = route.getEndpoint();
    if (endpoint instanceof CxfRsEndpoint) {
      final CxfRsEndpoint rsEnspoint = (CxfRsEndpoint) endpoint;
      final Bus endpointBus = rsEnspoint.getBus();
      if (endpointBus == null || (endpointBus != bus && !(endpointBus
          .getExtension(HttpDestinationFactory.class) instanceof UndertowDestinationFactory))) {
        /* Not a correct bus instance */
        throw new IllegalStateException("A " + CxfRsEndpoint.class.getName() + " used in route " + route
            + " either does not have " + Bus.class.getName() + " set or the "
            + Bus.class.getSimpleName() + " set was not created using correct context class loader."
            + " This is known to happen for " + CxfRsEndpoint.class.getName()
            + " instances created by direct constructor invocation."
            + " Consider using camelContext.getEndpoint(\"cxfrs:http[s]://my-host/my-endpoint\", CxfRsEndpoint.class) instead"
            + " or add your manually created endpoint to the context management manually using CamelContext.addEndpoint(String uri, Endpoint endpoint)");
      }
    }
  }
}

代码示例来源:origin: org.apache.camel/camel-opentracing

@Override
  public void onExchangeDone(Route route, Exchange exchange) {
    try {
      if (isExcluded(exchange, route.getEndpoint())) {
        return;
      }
      Span span = ActiveSpanManager.getSpan(exchange);
      if (span != null) {
        if (LOG.isTraceEnabled()) {
          LOG.trace("OpenTracing: finish server span={}", span);
        }
        SpanDecorator sd = getSpanDecorator(route.getEndpoint());
        sd.post(span, exchange, route.getEndpoint());
        span.finish();
        ActiveSpanManager.deactivate(exchange);
      } else {
        LOG.warn("OpenTracing: could not find managed span for exchange={}", exchange);
      }
    } catch (Throwable t) {
      // This exception is ignored
      LOG.warn("OpenTracing: Failed to capture tracing data", t);
    }
  }
}

代码示例来源:origin: org.apache.camel/camel-opentracing

@Override
public void onExchangeBegin(Route route, Exchange exchange) {
  try {
    if (isExcluded(exchange, route.getEndpoint())) {
      return;
    }
    SpanDecorator sd = getSpanDecorator(route.getEndpoint());
    Span span = tracer.buildSpan(sd.getOperationName(exchange, route.getEndpoint()))
      .asChildOf(tracer.extract(Format.Builtin.TEXT_MAP, sd.getExtractAdapter(exchange.getIn().getHeaders(), encoding)))
      .withTag(Tags.SPAN_KIND.getKey(), sd.getReceiverSpanKind()).start();
    sd.pre(span, exchange, route.getEndpoint());
    ActiveSpanManager.activate(exchange, span);
    if (LOG.isTraceEnabled()) {
      LOG.trace("OpenTracing: start server span={}", span);
    }
  } catch (Throwable t) {
    // This exception is ignored
    LOG.warn("OpenTracing: Failed to capture tracing data", t);
  }
}

代码示例来源:origin: org.apache.camel/camel-zookeeper-master

private CamelNodeState createNodeState() {
  String containerId = getContainerIdFactory().newContainerId();
  CamelNodeState state = new CamelNodeState(getGroupName(), containerId);
  state.setConsumer(route.getEndpoint().getEndpointUri());
  return state;
}

代码示例来源:origin: com.bosch.bis.monitoring/bis-event-publisher-impl

private void reportNonCustomRouteIDs(Route route) {
  CamelContext camelContext = route.getRouteContext().getCamelContext();
  RouteDefinition routeDefinition = camelContext.getRouteDefinition(route.getId());
  if (routeDefinition.getCustomId() == null || !routeDefinition.getCustomId()) {
    LOG.warn("Problem detected: Route " + StringUtils.quote(route.getId()) + " has no custom ID set! Endpoint URI is " + route.getEndpoint().getEndpointUri());
  }
}

代码示例来源:origin: org.apache.camel/camel-quartz

Endpoint endpoint = route.getEndpoint();
if (endpoint instanceof DelegateEndpoint) {
  endpoint = ((DelegateEndpoint)endpoint).getEndpoint();

代码示例来源:origin: org.apache.camel/camel-quartz2

Endpoint endpoint = route.getEndpoint();
if (endpoint instanceof DelegateEndpoint) {
  endpoint = ((DelegateEndpoint)endpoint).getEndpoint();

代码示例来源:origin: org.apache.uima/uima-ducc-common

logger.info(methodName, null, "Stopping Route:"+route.getId());
route.getConsumer().stop();
route.getEndpoint().stop();

代码示例来源:origin: org.apache.uima/uima-ducc-common

logger.info("start",null, "---OR Route in Camel Context-"+route.getEndpoint().getEndpointUri()+" Route State:"+context.getRouteStatus(route.getId()));

代码示例来源:origin: org.apache.camel/camel-zookeeper-master

@Override
protected void doStart() throws Exception {
  super.doStart();
  ObjectHelper.notNull(camelContext, "CamelContext");
  ObjectHelper.notEmpty("groupName", groupName);
  String path = getCamelClusterPath(groupName);
  this.groupListener = new ZookeeperGroupListenerSupport(path, route.getEndpoint(), onLockOwned(), onDisconnected());
  this.groupListener.setCamelContext(camelContext);
  this.groupListener.setCurator(curator);
  this.groupListener.setMaximumConnectionTimeout(maximumConnectionTimeout);
  this.groupListener.setZooKeeperUrl(zooKeeperUrl);
  this.groupListener.setZooKeeperPassword(zooKeeperPassword);
  ServiceHelper.startService(groupListener);
  log.info("Attempting to become master for endpoint: " + route.getEndpoint() + " in " + getCamelContext() + " with singletonID: " + getGroupName());
  thisNodeState = createNodeState();
  groupListener.updateState(thisNodeState);
}

相关文章

微信公众号

最新文章

更多