Beispiel #1
0
 @Override
 protected void doStart() throws Exception {
   server = SoapServer.builder().httpPort(configuration.getPort()).build();
   server.start();
   server.registerRequestResponder(configuration.getContext(), new CamelResponder(builder));
   super.doStart();
 }
 @Override
 protected void doStart() throws Exception {
   new Thread() {
     @Override
     public void run() {
       try {
         // TODO support multiple address subscroption
         Messenger messenger = getEndpoint().getMessenger();
         messenger.subscribe(getEndpoint().getAddress());
         while (true) {
           messenger.recv();
           while (messenger.incoming() > 0) {
             Message msg = messenger.get();
             Section body = msg.getBody();
             AmqpValue amqpValue = (AmqpValue) body;
             Exchange exchange =
                 ExchangeBuilder.anExchange(getEndpoint().getCamelContext())
                     .withBody(amqpValue.getValue())
                     .build();
             getProcessor().process(exchange);
           }
         }
       } catch (Exception e) {
         e.printStackTrace();
       }
     }
   }.start();
   super.doStart();
 }
  @Override
  protected void doStart() throws Exception {
    super.doStart();

    executor = getEndpoint().createExecutor();

    executor.submit(new ReplicationControllersConsumerTask());
  }
  @Override
  protected void doStart() throws Exception {
    super.doStart();

    // validate that if backoff multiplier is in use, the threshold values is set correclty
    if (backoffMultiplier > 0) {
      if (backoffIdleThreshold <= 0 && backoffErrorThreshold <= 0) {
        throw new IllegalArgumentException(
            "backoffIdleThreshold and/or backoffErrorThreshold must be configured to a positive value when using backoffMultiplier");
      }
      LOG.debug(
          "Using backoff[multiplier={}, idleThreshold={}, errorThreshold={}] on {}",
          new Object[] {
            backoffMultiplier, backoffIdleThreshold, backoffErrorThreshold, getEndpoint()
          });
    }

    if (scheduler == null) {
      scheduler = new DefaultScheduledPollConsumerScheduler();
    }
    scheduler.setCamelContext(getEndpoint().getCamelContext());
    scheduler.onInit(this);
    scheduler.scheduleTask(this);

    // configure scheduler with options from this consumer
    Map<String, Object> properties = new HashMap<String, Object>();
    IntrospectionSupport.getProperties(this, properties, null);
    IntrospectionSupport.setProperties(
        getEndpoint().getCamelContext().getTypeConverter(), scheduler, properties);
    if (schedulerProperties != null && !schedulerProperties.isEmpty()) {
      // need to use a copy in case the consumer is restarted so we keep the properties
      Map<String, Object> copy = new HashMap<String, Object>(schedulerProperties);
      IntrospectionSupport.setProperties(
          getEndpoint().getCamelContext().getTypeConverter(), scheduler, copy);
      if (copy.size() > 0) {
        throw new FailedToCreateConsumerException(
            getEndpoint(),
            "There are "
                + copy.size()
                + " scheduler parameters that couldn't be set on the endpoint."
                + " Check the uri if the parameters are spelt correctly and that they are properties of the endpoint."
                + " Unknown parameters=["
                + copy
                + "]");
      }
    }

    ObjectHelper.notNull(scheduler, "scheduler", this);
    ObjectHelper.notNull(pollStrategy, "pollStrategy", this);

    ServiceHelper.startService(scheduler);

    if (isStartScheduler()) {
      startScheduler();
    }
  }
 @Override
 protected void doStart() throws Exception {
   super.doStart();
   executor =
       endpoint
           .getCamelContext()
           .getExecutorServiceManager()
           .newFixedThreadPool(this, endpoint.getEndpointUri(), 1);
   listener = new Listener(endpoint, processor, socketFactory, contextFactory);
   executor.submit(listener);
 }
 @Override
 protected void doStart() throws Exception {
   CamelWorkflowDefinitionFactoryFactory factoryFactory =
       new CamelWorkflowDefinitionFactoryFactory(this, configuration);
   genericWorker =
       new GenericWorkflowWorker(
           endpoint.getSWClient(), configuration.getDomainName(), configuration.getWorkflowList());
   genericWorker.setWorkflowDefinitionFactoryFactory(factoryFactory);
   genericWorker.start();
   super.doStart();
 }
 @Override
 protected void doStart() throws Exception {
   super.doStart();
   Properties props = new Properties();
   props.put("org.ops4j.pax.logging.appender.name", endpoint.getName());
   registration =
       endpoint
           .getComponent()
           .getBundleContext()
           .registerService(PaxAppender.class.getName(), this, props);
   executor = Executors.newSingleThreadExecutor();
 }
Beispiel #8
0
  /**
   * Initializes the mbean server connection and starts listening for Notification events from the
   * object.
   */
  @Override
  protected void doStart() throws Exception {
    super.doStart();

    JMXEndpoint ep = (JMXEndpoint) getEndpoint();

    // connect to the mbean server
    if (ep.isPlatformServer()) {
      setServerConnection(ManagementFactory.getPlatformMBeanServer());
    } else {
      JMXServiceURL url = new JMXServiceURL(ep.getServerURL());
      String[] creds = {ep.getUser(), ep.getPassword()};
      Map<String, String[]> map = Collections.singletonMap(JMXConnector.CREDENTIALS, creds);
      JMXConnector connector = JMXConnectorFactory.connect(url, map);
      setServerConnection(connector.getMBeanServerConnection());
    }
    // subscribe
    addNotificationListener();
  }
Beispiel #9
0
  @Override
  protected void doStart() throws Exception {
    super.doStart();

    // create listener container
    if (listenerContainer == null) {
      createMessageListenerContainer();
    }

    listenerContainer.afterPropertiesSet();

    // only start listener if auto start is enabled or we are explicit invoking start later
    if (initialized || getEndpoint().isAutoStartup()) {
      // should we pre test connections before starting?
      if (getEndpoint().isTestConnectionOnStartup()) {
        testConnectionOnStartup();
      }
      startListenerContainer();
    }

    // mark as initialized for the first time
    initialized = true;
  }
 @Override
 protected void doStart() throws Exception {
   super.doStart();
   ((ActivitiEndpoint) getEndpoint()).addConsumer(this);
 }
 @Override
 protected void doStart() throws Exception {
   ((QuickfixjEndpoint) getEndpoint()).ensureInitialized();
   super.doStart();
 }
Beispiel #12
0
 @Override
 protected void doStart() throws Exception {
   super.doStart();
   endpoint.setActiveConsumer(this);
 }
Beispiel #13
0
 @Override
 protected void doStart() throws Exception {
   super.doStart();
   getEndpoint().consumerStarted(this);
 }