Refine search
@Override public void afterPropertiesSet() { if (endpoint == null) { if (ObjectHelper.isNotEmpty(camelContextId)) { camelContext = CamelContextResolverHelper.getCamelContextWithId(applicationContext, camelContextId); endpoint = camelContext.getRegistry().lookupByNameAndType(getServiceRef(), Endpoint.class); } else { endpoint = camelContext.getEndpoint(getServiceUrl()); ServiceHelper.startService(endpoint); producer = endpoint.createProducer(); camelContext.addService(producer, true, true); serviceProxy = ProxyHelper.createProxy(endpoint, bind, producer, getServiceInterface()); } catch (Exception e) {
if (camelCtx.getStatus() == ServiceStatus.Started || camelCtx.getStatus() == ServiceStatus.Starting) throw new IgniteException("Failed to start Camel streamer (CamelContext already started or starting)."); consumer = endpoint.createConsumer(this); ServiceHelper.startServices(camelCtx, endpoint, consumer); ServiceHelper.stopAndShutdownServices(camelCtx, endpoint, consumer);
public void afterPropertiesSet() throws Exception { // lets bind the URI to a pojo notNull(uri, "uri"); // Always resolve the camel context by using the camelContextID if (ObjectHelper.isNotEmpty(camelContextId)) { camelContext = CamelContextResolverHelper.getCamelContextWithId(applicationContext, camelContextId); } notNull(camelContext, "camelContext"); if (serviceRef != null && getService() == null && applicationContext != null) { setService(applicationContext.getBean(serviceRef)); } Endpoint endpoint = CamelContextHelper.getMandatoryEndpoint(camelContext, uri); notNull(getService(), "service"); Object proxy = getProxyForService(); try { // need to start endpoint before we create consumer ServiceHelper.startService(endpoint); consumer = endpoint.createConsumer(new BeanProcessor(proxy, camelContext)); // add and start consumer camelContext.addService(consumer, true, true); } catch (Exception e) { throw new FailedToCreateConsumerException(endpoint, e); } }
@Override protected void doStart() throws Exception { ObjectHelper.notNull(camelContext, "CamelContext", this); camelContext.getManagementStrategy().addEventNotifier(eventNotifier); if (!camelContext.getRoutePolicyFactories().contains(this)) { camelContext.addRoutePolicyFactory(this); if (ObjectHelper.isNotEmpty(host) && ObjectHelper.isNotEmpty(port)) { LOG.info("Auto-configuring Zipkin URLConnectionSender using host: {} and port: {}", host, port); int num = camelContext.getTypeConverter().mandatoryConvertTo(Integer.class, port); ServiceHelper.startServices(spanReporter, eventNotifier);
&& camelContext.getStatus().isStopped()) { LOG.debug("Post-processing CamelContext bean: {}", camelContext.getName()); if (match && ObjectHelper.isNotEmpty(exclude)) { if (match && ObjectHelper.isNotEmpty(include)) { try { LOG.debug("Injecting following route into the CamelContext: {}", routesBuilder); camelContext.addRoutes(routesBuilder); } catch (Exception e) { throw new CamelSpringBootInitializationException(e); controller.getCompleted(), controller.getLatch(), true); ServiceHelper.startService(notifier); camelContext.getManagementStrategy().addEventNotifier(notifier); completed, latch, false); ServiceHelper.startService(notifier); camelContext.getManagementStrategy().addEventNotifier(notifier);
@Override protected void doStart() throws Exception { super.doStart(); if (meterRegistry == null) { meterRegistry = MicrometerUtils.getOrCreateMeterRegistry(camelContext.getRegistry(), METRICS_REGISTRY_NAME); } try { MicrometerEventNotifierService registryService = camelContext.hasService(MicrometerEventNotifierService.class); if (registryService == null) { registryService = new MicrometerEventNotifierService(); registryService.setMeterRegistry(getMeterRegistry()); registryService.setPrettyPrint(isPrettyPrint()); registryService.setDurationUnit(getDurationUnit()); registryService.setMatchingTags(Tags.of(SERVICE_NAME, registryService.getClass().getSimpleName())); camelContext.addService(registryService); // ensure registry service is started ServiceHelper.startService(registryService); } } catch (Exception e) { throw ObjectHelper.wrapRuntimeCamelException(e); } }
@Override protected void doStart() throws Exception { ObjectHelper.notNull(configuration, "configuration"); ObjectHelper.notNull(camelContext, "camel context"); if (serviceDiscovery != null) { LOGGER.info("ServiceCall is using ribbon load balancer with service discovery type: {} and service filter: {}", serviceDiscovery.getClass(), serviceDiscovery != null ? serviceFilter.getClass() : "none"); } else { LOGGER.info("ServiceCall is using ribbon load balancer"); } ServiceHelper.startService(serviceDiscovery); }
if (!ObjectHelper.isEmpty(basePath)) { url += "/" + basePath; if (!ObjectHelper.isEmpty(uriTemplate)) { url += "/" + uriTemplate; config = camelContext.getRestConfiguration("http", true); HttpEndpoint endpoint = camelContext.getEndpoint(url, HttpEndpoint.class); if (parameters != null && !parameters.isEmpty()) { setProperties(camelContext, endpoint, parameters); ServiceHelper.startService(endpoint);
@Override protected void doStart() throws Exception { ObjectHelper.notNull(camelContext, "CamelContext", this); camelContext.getManagementStrategy().addEventNotifier(eventNotifier); if (!camelContext.getRoutePolicyFactories().contains(this)) { camelContext.addRoutePolicyFactory(this); } camelContext.addLogListener(logListener); if (tracer == null) { Set<Tracer> tracers = camelContext.getRegistry().findByType(Tracer.class); if (tracers.size() == 1) { tracer = tracers.iterator().next(); } } if (tracer == null) { tracer = TracerResolver.resolveTracer(); } if (tracer == null) { // No tracer is available, so setup NoopTracer tracer = NoopTracerFactory.create(); } ServiceHelper.startServices(eventNotifier); }
protected void doStart() throws Exception { ObjectHelper.notNull(configuration, "setNettyServerBootstrapConfiguration() must be called with a NettyServerBootstrapConfiguration instance", this); // port must be set if (configuration.getPort() <= 0) { throw new IllegalArgumentException("Port must be configured on NettySharedHttpServerBootstrapConfiguration " + configuration); } // hostname must be set if (ObjectHelper.isEmpty(configuration.getHost())) { throw new IllegalArgumentException("Host must be configured on NettySharedHttpServerBootstrapConfiguration " + configuration); } LOG.debug("NettySharedHttpServer using configuration: {}", configuration); // force using tcp as the underlying transport configuration.setProtocol("tcp"); channelFactory = new HttpServerMultiplexChannelHandler(); channelFactory.init(configuration.getPort()); ChannelPipelineFactory pipelineFactory = new HttpServerSharedPipelineFactory(configuration, channelFactory, classResolver); // thread factory and pattern String port = Matcher.quoteReplacement("" + configuration.getPort()); String pattern = threadPattern; pattern = pattern.replaceFirst("#port#", port); ThreadFactory tf = new CamelThreadFactory(pattern, "NettySharedHttpServer", true); // create bootstrap factory and disable compatible check as its shared among the consumers bootstrapFactory = new HttpServerBootstrapFactory(channelFactory, false); bootstrapFactory.init(tf, configuration, pipelineFactory); ServiceHelper.startServices(channelFactory); if (startServer) { LOG.info("Starting NettySharedHttpServer on {}:{}", configuration.getHost(), configuration.getPort()); ServiceHelper.startServices(bootstrapFactory); } }
@Override protected void doStart() throws Exception { ObjectHelper.notNull(camelContext, "CamelContext", this); timeoutLogger = new CamelLogger(LOG, timeoutLoggingLevel); if (scheduledExecutorService == null) { scheduledExecutorService = camelContext.getExecutorServiceManager().newSingleThreadScheduledExecutor(this, "NettyTimeoutCorrelationManager"); } if (workerPool == null) { workerPool = camelContext.getExecutorServiceManager().newDefaultThreadPool(this, "NettyTimeoutWorkerPool"); } map = new NettyStateTimeoutMap(scheduledExecutorService); ServiceHelper.startService(map); }
@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); }
public void init() throws Exception { db = mongo.getDB(dbname); typeConverter = context.getTypeConverter(); // load the type hints typeHints = new Properties(); try { typeHints.load(this.getClass().getClassLoader().getResourceAsStream("typeHints.properties")); } catch (IOException e) { e.printStackTrace(); } xmlJson.setForceTopLevelObject(true); ServiceHelper.startService(xmlJson); }
@Override protected void doStart() throws Exception { jsonMarshalEndpoint = getCamelContext().getEndpoint("dataformat:json-jackson:marshal"); Objects.requireNonNull(jsonMarshalEndpoint, "jsonMarshalEndpoint"); jsonMarshalProducer = jsonMarshalEndpoint.createProducer(); Objects.requireNonNull(jsonMarshalProducer, "jsonMarshalProducer"); ServiceHelper.startServices(jsonMarshalEndpoint, jsonMarshalProducer); super.doStart(); }
@Override protected void doStart() throws Exception { String url = getEndpoint().getUrl() + "?authUsername=" + getEndpoint().getUsername() + "&authPassword=" + getEndpoint().getPassword() + "&authMethod=Basic"; if (log.isInfoEnabled()) { log.info("Creating NetWeaverProducer using url: {}", URISupport.sanitizeUri(url)); } http = getEndpoint().getCamelContext().getEndpoint(url).createProducer(); ServiceHelper.startService(http); }
private synchronized void onLeadershipTaken() throws Exception { if (!isRunAllowed()) { return; } if (delegatedConsumer != null) { return; } delegatedConsumer = delegatedEndpoint.createConsumer(processor); if (delegatedConsumer instanceof StartupListener) { getEndpoint().getCamelContext().addStartupListener((StartupListener) delegatedConsumer); } ServiceHelper.startService(delegatedEndpoint); ServiceHelper.startService(delegatedConsumer); LOGGER.info("Leadership taken: consumer started: {}", delegatedEndpoint); }
protected void initialize() throws Exception { // start the service here camelEndpoint = getCamelContext().getEndpoint(getCamelEndpointUri()); consumer = camelEndpoint.createConsumer(new ConsumerProcessor()); ServiceHelper.startService(consumer); }
protected void unInitReplyManager() { try { if (replyManager != null) { if (LOG.isDebugEnabled()) { LOG.debug("Stopping JmsReplyManager: {} from processing replies from: {}", replyManager, endpoint.getReplyTo() != null ? endpoint.getReplyTo() : "temporary queue"); } ServiceHelper.stopService(replyManager); } } catch (Exception e) { throw ObjectHelper.wrapRuntimeCamelException(e); } finally { started.set(false); } }
@Override protected void doStart() throws Exception { super.doStart(); // use file watch service if we read from file if (endpoint.isFileWatcher()) { String dir = new File(endpoint.getFileName()).getParent(); fileWatcher = new FileWatcherStrategy(dir, (file) -> { String onlyName = file.getName(); String target = FileUtil.stripPath(endpoint.getFileName()); LOG.trace("File changed: {}", onlyName); if (onlyName.equals(target)) { // file is changed watchFileChanged = true; } }); fileWatcher.setCamelContext(getEndpoint().getCamelContext()); } ServiceHelper.startService(fileWatcher); // if we scan the stream we are lenient and can wait for the stream to be available later if (!endpoint.isScanStream()) { initializeStream(); } executor = endpoint.getCamelContext().getExecutorServiceManager().newSingleThreadExecutor(this, endpoint.getEndpointUri()); executor.execute(this); if (endpoint.getGroupLines() < 0) { throw new IllegalArgumentException("Option groupLines must be 0 or positive number, was " + endpoint.getGroupLines()); } }
@Override protected void doStart() throws Exception { super.doStart(); ServiceHelper.startService(endpoint); }