@Override public int hashCode() { int result = getStreamId().hashCode(); result = 31 * result + (getSchema() != null ? getSchema().hashCode() : 0); result = 31 * result + (getSinkConfig() != null ? getSinkConfig().hashCode() : 0); result = 31 * result + (getSourceConfig() != null ? getSourceConfig().hashCode() : 0); return result; } }
@Override public void open(StreamDesc streamDesc) { if (streamDesc.getSchema() != null) { this.validator = new StreamValidator(streamDesc.getSchema()); } this.streamId = streamDesc.getStreamId(); if (streamDesc.getSinkConfig() != null) { this.proxyProducer = new KafkaStreamProxyProducerImpl(streamDesc.getStreamId(), streamDesc.getSinkConfig()); } else { LOGGER.warn("Unable to initialize kafka producer because sink config is null for {}", streamId); this.proxyProducer = null; } this.opened = true; }
@Override public boolean equals(Object o) { if (this == o) { return true; } if (!(o instanceof StreamDesc)) { return false; } StreamDesc that = (StreamDesc) o; if (!getStreamId().equals(that.getStreamId())) { return false; } if (getSchema() != null ? !getSchema().equals(that.getSchema()) : that.getSchema() != null) { return false; } if (getSinkConfig() != null ? !getSinkConfig().equals(that.getSinkConfig()) : that.getSinkConfig() != null) { return false; } return getSourceConfig() != null ? getSourceConfig().equals(that.getSourceConfig()) : that.getSourceConfig() == null; }
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); } }