Exemple #1
0
  @Override
  protected void doStart() throws Exception {

    if (isEndpointTransacted()) {
      throw new IllegalArgumentException(
          "InOut exchange pattern is incompatible with transacted=true as it cuases a deadlock. Please use transacted=false or InOnly exchange pattern.");
    }

    if (getConnectionResource() == null) {
      throw new IllegalArgumentException(
          String.format("ConnectionResource or ConnectionFactory must be configured for %s", this));
    }

    if (ObjectHelper.isEmpty(getNamedReplyTo())) {
      log.debug("No reply to destination is defined.  Using temporary destinations.");
    } else {
      log.debug("Using {} as the reply to destination.", getNamedReplyTo());
    }
    if (uuidGenerator == null) {
      // use the generator configured on the camel context
      uuidGenerator = getEndpoint().getCamelContext().getUuidGenerator();
    }
    if (consumers == null) {
      consumers =
          new GenericObjectPool<MessageConsumerResources>(new MessageConsumerResourcesFactory());
      consumers.setMaxActive(getConsumerCount());
      consumers.setMaxIdle(getConsumerCount());
      while (consumers.getNumIdle() < consumers.getMaxIdle()) {
        consumers.addObject();
      }
    }
    super.doStart();
  }
 /** @return The current maximum number of allowable idle transformer objects in the pool */
 public int getMaxIdleTransformers() {
   return transformerPool.getMaxIdle();
 }