private Kafka2TupleMetadata buildAggregationDatasource() { Kafka2TupleMetadata datasource = new Kafka2TupleMetadata(); datasource.setName(NODATA_ALERT_AGGR_DATASOURCE_NAME); datasource.setType(DATASOURCE_TYPE); datasource.setSchemeCls(DATASOURCE_SCHEME_CLS); datasource.setTopic(NODATA_ALERT_AGGR_TOPIC_NAME); Tuple2StreamMetadata codec = new Tuple2StreamMetadata(); codec.setStreamNameSelectorCls(JSON_STRING_STREAM_NAME_SELECTOR_CLS); codec.setTimestampColumn(STREAM_TIMESTAMP_COLUMN_NAME); codec.setTimestampFormat(STREAM_TIMESTAMP_FORMAT); Properties codecProperties = new Properties(); codecProperties.put("userProvidedStreamName", NODATA_ALERT_AGGR_STREAM); codecProperties.put("streamNameFormat", "%s"); codec.setStreamNameSelectorProp(codecProperties); datasource.setCodec(codec); return datasource; }
private Kafka2TupleMetadata buildAggregationOutputDatasource() { Kafka2TupleMetadata datasource = new Kafka2TupleMetadata(); datasource.setName(NODATA_ALERT_AGGR_OUTPUT_DATASOURCE_NAME); datasource.setType(DATASOURCE_TYPE); datasource.setSchemeCls(DATASOURCE_SCHEME_CLS); datasource.setTopic(NODATA_ALERT_AGGR_OUTPUT_TOPIC_NAME); Tuple2StreamMetadata codec = new Tuple2StreamMetadata(); codec.setStreamNameSelectorCls(JSON_STRING_STREAM_NAME_SELECTOR_CLS); codec.setTimestampColumn(STREAM_TIMESTAMP_COLUMN_NAME); codec.setTimestampFormat(STREAM_TIMESTAMP_FORMAT); Properties codecProperties = new Properties(); codecProperties.put("userProvidedStreamName", NODATA_ALERT_AGGR_OUTPUT_STREAM); codecProperties.put("streamNameFormat", "%s"); codec.setStreamNameSelectorProp(codecProperties); datasource.setCodec(codec); return datasource; }
public void validateAndEnsureDefault() { Preconditions.checkNotNull(streamSource); Preconditions.checkNotNull(streamDefinition); if (streamSource.getType() == null) { streamSource.setType("KAFKA"); } String dataSourceName = (getStreamDefinition().getStreamId() + "_CUSTOMIZED").toUpperCase(); getStreamDefinition().setDataSource(dataSourceName); getStreamSource().setName(dataSourceName); Tuple2StreamMetadata codec = new Tuple2StreamMetadata(); codec.setTimestampColumn("timestamp"); codec.setStreamNameSelectorCls(JsonStringStreamNameSelector.class.getName()); Properties streamNameSelectorProp = new Properties(); streamNameSelectorProp.put("userProvidedStreamName", streamSource.getName()); codec.setStreamNameSelectorProp(streamNameSelectorProp); if (StringUtils.isBlank(codec.getStreamNameSelectorCls())) { codec.setStreamNameSelectorCls(JsonStringStreamNameSelector.class.getName()); } if (StringUtils.isBlank(codec.getTimestampFormat())) { codec.setTimestampFormat(null); } this.streamSource.setCodec(codec); } }