Support Questions

Find answers, ask questions, and share your expertise
Announcements
Celebrating as our community reaches 100,000 members! Thank you!

How can you set the Message Key Field property in the PublishKafkaRecord Processor?

avatar
Explorer

Hi,

I am using the PublishKafkaRecord processor to write messages to a Kafka topic. I am using the CSVReader for the Record Reader property and the AvroRecordSetWriter for the Record Writer property. I would like to set the message key of each message written to Kafka using one of the fields of the csv file by setting the Message Key Field property (see the image below). Please let me know if this is possible or an alternative approach where it can be set on a per record basis?

processor.png

Many thanks,

Paul

1 ACCEPTED SOLUTION

avatar
Master Guru

There should be a property called "Message Key Field" which is the name of the field in the records that you want to use as the message key. It depends how your CsvReader is configured... if it is creating a schema from the column headers then this value would be the name of the column, or if you are providing a specific schema then it would be the name of the field from the schema your provided.

View solution in original post

2 REPLIES 2

avatar
Master Guru

There should be a property called "Message Key Field" which is the name of the field in the records that you want to use as the message key. It depends how your CsvReader is configured... if it is creating a schema from the column headers then this value would be the name of the column, or if you are providing a specific schema then it would be the name of the field from the schema your provided.

avatar
Explorer

Thanks Bryan,

I am providing a schema to the CSVReader and it was simple as using the field name defined in the schema in the Message Key Field property.

Cheers,

Paul