use of io.confluent.ksql.serde.delimited.DelimitedFormat in project ksql by confluentinc.
the class ProducerFactory method getProducer.
static DataGenProducer getProducer(final Format keyFormat, final Format valueFormat, final String valueDelimiter, final Properties props) {
final KsqlConfig ksqlConfig = new KsqlConfig(props);
final Optional<SchemaRegistryClient> srClient = SchemaRegistryClientFactory.getSrClient(keyFormat, valueFormat, ksqlConfig);
final SerializerFactory<GenericKey> keySerializerFactory = keySerializerFactory(keyFormat, ksqlConfig, srClient);
final Map<String, String> formatInfoProperties = new HashMap<>();
if (valueDelimiter != null) {
if (!(valueFormat instanceof DelimitedFormat)) {
throw new IllegalArgumentException("valueDelimiter can only be specified with delimited format");
}
formatInfoProperties.put(DelimitedFormat.DELIMITER, valueDelimiter);
}
final SerializerFactory<GenericRow> valueSerializerFactory = valueSerializerFactory(valueFormat, ksqlConfig, srClient, formatInfoProperties);
return new DataGenProducer(keySerializerFactory, valueSerializerFactory);
}
Aggregations