this.effectiveConfig = ConfigFactory.parseMap(executionConfig) .withFallback(serverConfig) .withFallback(ConfigFactory.parseMap(metadata.getContext())) .withFallback(serverConfig.getConfig(AlertConstants.COORDINATOR)); } else { this.effectiveConfig = ConfigFactory.parseMap(executionConfig) .withFallback(serverConfig) .withFallback(ConfigFactory.parseMap(metadata.getContext()));
@Override public void register(ApplicationEntity appEntity) { if (environment == null) { LOG.warn("Environment is null, can not register"); return; } ApplicationProvider<?> appProvider = applicationProviderService.getApplicationProviderByType(appEntity.getDescriptor().getType()); Optional<HealthCheck> applicationHealthCheck = appProvider.getManagedHealthCheck( ConfigFactory.parseMap(appEntity.getContext()) .withFallback(config) .withFallback(ConfigFactory.parseMap(appEntity.getConfiguration())) ); if (!applicationHealthCheck.isPresent()) { LOG.warn("Application {} does not implement HealthCheck", appEntity.getAppId()); return; } this.environment.healthChecks().register(appEntity.getAppId(), applicationHealthCheck.get()); currentInjector.injectMembers(applicationHealthCheck.get()); synchronized (lock) { if (!appHealthChecks.containsKey(appEntity.getAppId())) { appHealthChecks.put(appEntity.getAppId(), applicationHealthCheck); LOG.info("Successfully register health check for {}", appEntity.getAppId()); } } }
parameterIndex++; if (entity.getContext() != null && !entity.getContext().isEmpty()) { statement.setString(parameterIndex, JSONObject.toJSONString(entity.getContext())); parameterIndex++;
updateSql += "configuration = ?, "; if (entity.getContext() != null && !entity.getContext().isEmpty()) { updateSql += "context = ?, ";
applicationEntity.getContext().put("siteId", siteEntity.getSiteId()); applicationEntity.getContext().put("appId", applicationEntity.getAppId());
private void fillApplicationDesc(List<ApplicationEntity> entities) { for (ApplicationEntity entity : entities) { entity.setDescriptor(applicationProviderService.getApplicationDescByType(entity.getDescriptor().getType())); if (entity.getDescriptor().getStreams() == null) { continue; } List<StreamDesc> streamDescToInstall = entity.getDescriptor().getStreams().stream().map((streamDefinition -> { StreamDefinition copied = streamDefinition.copy(); copied.setSiteId(entity.getSite().getSiteId()); copied.setStreamId(StreamIdConversions.formatSiteStreamId(entity.getSite().getSiteId(), copied.getStreamId())); Config effectiveConfig = ConfigFactory.parseMap(new HashMap<>(entity.getConfiguration())) .withFallback(config).withFallback(ConfigFactory.parseMap(entity.getContext())); ExecutionRuntime runtime = ExecutionRuntimeManager.getInstance().getRuntime( applicationProviderService.getApplicationProviderByType(entity.getDescriptor().getType()).getApplication().getEnvironmentType(), config); StreamSinkConfig streamSinkConfig = runtime.environment() .stream().getSinkConfig(StreamIdConversions.parseStreamTypeId(copied.getSiteId(), copied.getStreamId()), effectiveConfig); StreamDesc streamDesc = new StreamDesc(); streamDesc.setSchema(copied); streamDesc.setSinkConfig(streamSinkConfig); streamDesc.setStreamId(copied.getStreamId()); streamDesc.getSchema().setDataSource(entity.getAppId()); return streamDesc; })).collect(Collectors.toList()); entity.setStreams(streamDescToInstall); } }