Hey Everyone, I have a problem that feels off, bu...
# troubleshooting
j
Hey Everyone, I have a problem that feels off, but maybe I am doing this wrong. I want to create a KafkaSink, so I have a class that has a method:
Copy code
public 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?