How to add a field in the document to the header

Hi,

I have developed a custom connector project and developed a custom source handler. In this source handler, I overrode the handle method and built value and key. But also, I need to add a field in the document to the header. But the header can’t build via SourceRecordBuilder.

How can I add a field in a document to the header?

Hi @Sinan_Turemis

SourceRecordBuilder has a headers() method that returns a Headers object. You can add headers by calling methods on that object.

Thanks,
David

1 Like