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); } }
private void processStreams() { if (metadata.getDescriptor().getStreams() == null) { return; List<StreamDesc> streamDescToInstall = metadata.getDescriptor().getStreams().stream().map((streamDefinition -> { StreamDefinition copied = streamDefinition.copy(); copied.setSiteId(metadata.getSite().getSiteId());