@Override public void onInit(Route route) { super.onInit(route); this.route = route; }
@Override protected void doStop() throws Exception { if (managedClient) { client.close(); } super.doStop(); }
@Override protected void doStart() throws Exception { // validate StringHelper.notEmpty(lockMapName, "lockMapName", this); StringHelper.notEmpty(lockKey, "lockKey", this); StringHelper.notEmpty(lockValue, "lockValue", this); executorService = getCamelContext().getExecutorServiceManager().newSingleThreadExecutor(this, "HazelcastRoutePolicy"); locks = instance.getMap(lockMapName); future = executorService.submit(this::acquireLeadership); super.doStart(); }
@Override public void onExchangeDone(Route route, Exchange exchange) { super.onExchangeDone(route, exchange); LOG.info("Exchange Done for route " + route.getId() + " exchange: " + exchange.getExchangeId() + " in: " + exchange.getIn().getBody(String.class)); stopCurrentRouteAsync(route); }
@Override public void onExchangeBegin(Route route, Exchange exchange) { super.onExchangeBegin(route, exchange); LOG.info("Exchange Begin for route " + route.getId() + " exchange: " + exchange.getExchangeId()); }
@Override protected void doStart() throws Exception { ObjectHelper.notNull(camelContext, "camelContext"); ObjectHelper.notNull(clientUris, "clientUris"); if (client == null) { client = new EtcdClient(EtcdHelper.resolveURIs(camelContext, clientUris)); managedClient = true; } setLeader(tryTakeLeadership()); watch(); super.doStart(); }
@Override public void onExchangeDone(Route route, Exchange exchange) { super.onExchangeDone(route, exchange); LOG.info("Exchange Done for route " + route.getId() + " exchange: " + exchange.getExchangeId() + " in: " + exchange.getIn().getBody(String.class)); try { stopRoute(route); } catch (Exception e) { throw new RuntimeExchangeException(e.getMessage(), exchange, e); } } }
@Override public void onExchangeBegin(Route route, Exchange exchange) { super.onExchangeBegin(route, exchange); LOG.info("Exchange Begin for route " + route.getId() + " exchange: " + exchange.getExchangeId()); }
@Override public void onInit(Route route) { super.onInit(route); this.route = route; }
@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); }
@Override protected void doStop() throws Exception { super.doStop(); ServiceHelper.stopAndShutdownServices(groupListener); masterConsumer.set(false); }
@Override public void onInit(Route route) { super.onInit(route); this.route = route; }
@Override protected void doStop() throws Exception { if (future != null) { future.cancel(true); future = null; } if (managedInstance) { instance.shutdown(); } getCamelContext().getExecutorServiceManager().shutdownGraceful(executorService); super.doStop(); } // *************************************************************************
@Override public void onInit(Route route) { super.onInit(route); this.route = route; }
@Override protected void doStop() throws Exception { super.doStop(); if (sessionId != null) { sessionClient.destroySession(sessionId); sessionId = null; } if (executorService != null) { getCamelContext().getExecutorServiceManager().shutdownGraceful(executorService); } }
@Override public synchronized void onInit(Route route) { super.onInit(route); LOGGER.info("Route managed by {}. Setting route {} AutoStartup flag to false.", getClass(), route.getId()); route.getRouteContext().getRoute().setAutoStartup("false"); stoppeddRoutes.add(route); this.refCount.retain(); startManagedRoutes(); }
@Override public void onInit(Route route) { super.onInit(route); if (getMeterRegistry() == null) { setMeterRegistry(MicrometerUtils.getOrCreateMeterRegistry( route.getRouteContext().getCamelContext().getRegistry(), METRICS_REGISTRY_NAME)); } try { MicrometerRoutePolicyService registryService = route.getRouteContext().getCamelContext().hasService(MicrometerRoutePolicyService.class); if (registryService == null) { registryService = new MicrometerRoutePolicyService(); registryService.setMeterRegistry(getMeterRegistry()); registryService.setPrettyPrint(isPrettyPrint()); registryService.setDurationUnit(getDurationUnit()); registryService.setMatchingTags(Tags.of(SERVICE_NAME, MicrometerRoutePolicyService.class.getSimpleName())); route.getRouteContext().getCamelContext().addService(registryService); ServiceHelper.startService(registryService); } } catch (Exception e) { throw ObjectHelper.wrapRuntimeCamelException(e); } // create statistics holder // for now we record only all the timings of a complete exchange (responses) // we have in-flight / total statistics already from camel-core statistics = new MetricsStatistics(getMeterRegistry(), route, getNamingStrategy()); }
@Override public void onInit(Route route) { super.onInit(route);