the-other-tim-brown commented on code in PR #11070:
URL: https://github.com/apache/hudi/pull/11070#discussion_r1595525900
##########
hudi-utilities/src/test/java/org/apache/hudi/utilities/sources/TestProtoKafkaSource.java:
##########
@@ -198,22 +235,48 @@ private static Nested generateRandomNestedMessage() {
@Override
void sendMessagesToKafka(String topic, int count, int numPartitions) {
List<Sample> messages = createSampleMessages(count);
- try (Producer<String, byte[]> producer = new
KafkaProducer<>(getProducerProperties())) {
+ try (Producer<String, byte[]> producer = new
KafkaProducer<>(getProducerProperties(false))) {
for (int i = 0; i < messages.size(); i++) {
// use consistent keys to get even spread over partitions for test
expectations
producer.send(new ProducerRecord<>(topic, Integer.toString(i %
numPartitions), messages.get(i).toByteArray()));
}
}
}
- private Properties getProducerProperties() {
+ private void sendMessagesToKafkaWithConfluentSerializer(String topic, int
numPartitions, List<Sample> messages) {
+ try (Producer<String, Message> producer = new
KafkaProducer<>(getProducerProperties(true))) {
+ for (int i = 0; i < messages.size(); i++) {
+ // use consistent keys to get even spread over partitions for test
expectations
+ producer.send(new ProducerRecord<>(topic, Integer.toString(i %
numPartitions), messages.get(i)));
+ }
+ }
+ }
+
+ private Properties getProducerProperties(boolean
useConfluentProtobufSerializer) {
Properties props = new Properties();
props.put("bootstrap.servers", testUtils.brokerAddress());
- props.put("value.serializer", ByteArraySerializer.class.getName());
- // Key serializer is required.
+ if (useConfluentProtobufSerializer) {
+ props.put("value.serializer",
+ "io.confluent.kafka.serializers.protobuf.KafkaProtobufSerializer");
+ props.put("value.deserializer",
+ "io.confluent.kafka.serializers.protobuf.KafkaProtobufDeserializer");
Review Comment:
At the time, my intellij imports were not working. Updating this now
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]