Example #1
0
 /**
  * Gets all the consumer endpoints.
  *
  * @return consumer endpoints
  */
 public static Collection<Endpoint> getConsumerEndpoints() {
   Collection<Endpoint> endpoints = new ArrayList<Endpoint>(CONSUMERS.size());
   for (DirectVmConsumer consumer : CONSUMERS.values()) {
     endpoints.add(consumer.getEndpoint());
   }
   return endpoints;
 }
Example #2
0
 public void addConsumer(DirectVmEndpoint endpoint, DirectVmConsumer consumer) {
   String key = getConsumerKey(endpoint.getEndpointUri());
   DirectVmConsumer existing = CONSUMERS.putIfAbsent(key, consumer);
   if (existing != null) {
     String contextId = existing.getEndpoint().getCamelContext().getName();
     throw new IllegalStateException(
         "A consumer "
             + existing
             + " already exists from CamelContext: "
             + contextId
             + ". Multiple consumers not supported");
   }
 }