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

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

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

Route.getConsumer介绍

暂无

代码示例

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

@ManagedAttribute(description = "The consumer endpoint", mask = true)
public String getEndpointUrl() {
  if (route != null && route.getConsumer() != null && route.getConsumer().getEndpoint() != null) {
    return route.getConsumer().getEndpoint().toString();
  }
  return null;
}

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

@ManagedAttribute(description = "The consumer endpoint", mask = true)
public String getEndpointUrl() {
  if (route != null && route.getConsumer() != null && route.getConsumer().getEndpoint() != null) {
    return route.getConsumer().getEndpoint().toString();
  }
  return null;
}

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

@ManagedAttribute(description = "The consumer endpoint", mask = true)
public String getEndpointUrl() {
  if (route != null && route.getConsumer() != null && route.getConsumer().getEndpoint() != null) {
    return route.getConsumer().getEndpoint().toString();
  }
  return null;
}

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

private synchronized void stopConsumer(Route route) {
  try {
    if (!suspendedRoutes.contains(route)) {
      LOGGER.debug("Stopping consumer for {} ({})", route.getId(), route.getConsumer());
      stopConsumer(route.getConsumer());
      suspendedRoutes.add(route);
    }
  } catch (Exception e) {
    handleException(e);
  }
}

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

private void stopConsumer(Route route) {
  synchronized (lock) {
    try {
      if (!suspendedRoutes.contains(route)) {
        LOGGER.debug("Stopping consumer for {} ({})", route.getId(), route.getConsumer());
        stopConsumer(route.getConsumer());
        suspendedRoutes.add(route);
      }
    } catch (Exception e) {
      handleException(e);
    }
  }
}

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

private void stopConsumer(Route route) {
  synchronized (lock) {
    try {
      if (!suspendedRoutes.contains(route)) {
        LOGGER.debug("Stopping consumer for {} ({})", route.getId(), route.getConsumer());
        stopConsumer(route.getConsumer());
        suspendedRoutes.add(route);
      }
    } catch (Exception e) {
      handleException(e);
    }
  }
}

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

private void startAllStoppedConsumers() {
  synchronized (lock) {
    try {
      for (Route route : suspendedRoutes) {
        LOGGER.debug("Starting consumer for {} ({})", route.getId(), route.getConsumer());
        startConsumer(route.getConsumer());
      }
      suspendedRoutes.clear();
    } catch (Exception e) {
      handleException(e);
    }
  }
}

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

private synchronized void startAllStoppedConsumers() {
  try {
    for (Route route : suspendedRoutes) {
      LOGGER.debug("Starting consumer for {} ({})", route.getId(), route.getConsumer());
      startConsumer(route.getConsumer());
    }
    suspendedRoutes.clear();
  } catch (Exception e) {
    handleException(e);
  }
}

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

private void stopConsumer(Route route) {
  try {
    lock.lock();
    // check that we should still suspend once the lock is acquired
    if (!suspendedRoutes.contains(route) && !shouldProcessExchanges.get()) {
      stopConsumer(route.getConsumer());
      suspendedRoutes.add(route);
    }
  } catch (Exception e) {
    handleException(e);
  } finally {
    lock.unlock();
  }
}

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

private void startConsumer(Route route) {
  try {
    lock.lock();
    if (suspendedRoutes.contains(route)) {
      startConsumer(route.getConsumer());
      suspendedRoutes.remove(route);
    }
  } catch (Exception e) {
    handleException(e);
  } finally {
    lock.unlock();
  }
}

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

private void startAllStoppedConsumers() {
  synchronized (lock) {
    try {
      for (Route route : suspendedRoutes) {
        LOGGER.debug("Starting consumer for {} ({})", route.getId(), route.getConsumer());
        startConsumer(route.getConsumer());
      }
      suspendedRoutes.clear();
    } catch (Exception e) {
      handleException(e);
    }
  }
}

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

private synchronized void startConsumer(Route route) {
  try {
    if (suspendedRoutes.contains(route)) {
      startConsumer(route.getConsumer());
      suspendedRoutes.remove(route);
    }
  } catch (Exception e) {
    handleException(e);
  }
}

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

private void startConsumer(Route route) {
  synchronized (lock) {
    try {
      if (suspendedRoutes.contains(route)) {
        startConsumer(route.getConsumer());
        suspendedRoutes.remove(route);
      }
    } catch (Exception e) {
      handleException(e);
    }
  }
}

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

private void startConsumer(Route route) {
  synchronized (lock) {
    try {
      if (suspendedRoutes.contains(route)) {
        startConsumer(route.getConsumer());
        suspendedRoutes.remove(route);
      }
    } catch (Exception e) {
      handleException(e);
    }
  }
}

代码示例来源: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-zookeeper

private void startAllStoppedConsumers() {
  try {
    lock.lock();
    if (!suspendedRoutes.isEmpty()) {
      if (log.isDebugEnabled()) {
        log.debug("{} have been stopped previously by policy, restarting.", suspendedRoutes.size());
      }
      for (Route suspended : suspendedRoutes) {
        startConsumer(suspended.getConsumer());
      }
      suspendedRoutes.clear();
    }
  } catch (Exception e) {
    handleException(e);
  } finally {
    lock.unlock();
  }
}

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

Consumer consumer = route.getConsumer();
if (consumer instanceof Runnable) {
  task = (Runnable) consumer;

代码示例来源:origin: OpenWiseSolutions/openhub-framework

if (route != null && route.getConsumer() != null && route.getConsumer().getEndpoint() != null) {
  uris.add(routeTypeInfo.getRoute().getConsumer().getEndpoint().getEndpointUri());

代码示例来源: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: org.apache.camel/camel-quartz2

@Override
public void onInit(Consumer consumer) {
  this.consumer = consumer;
  // find the route of the consumer
  for (Route route : consumer.getEndpoint().getCamelContext().getRoutes()) {
    if (route.getConsumer() == consumer) {
      this.routeId = route.getId();
      break;
    }
  }
}

相关文章