Jalil Alchy
03/22/2023, 12:59 PMpublic KafkaSink<OutboxRecord> getKafkaSink() {
KafkaRecordSerializationSchema<OutboxRecord> serializer = KafkaRecordSerializationSchema.<OutboxRecord>builder()
.setTopicSelector(x -> x.topic)
.setValueSerializationSchema(new KafkaOutboxRecordSerializer())
.build();
Properties p = new Properties() {
{
put("<http://transaction.timeout.ms|transaction.timeout.ms>", (Integer) 60000);
}
};
return KafkaSink.<OutboxRecord>builder()
.setBootstrapServers("localhost:9092")
.setKafkaProducerConfig(p)
.setRecordSerializer(serializer)
.build();
}
However this method causes the application to throw a not serializable error. If I make the method static, it gets better. Is there a better way to do this that I am missing?