Question

Avro Message Key for kafka producer

  • 22 February 2022
  • 3 replies
  • 125 views

Hi,  for Kafka producer, I’m trying to pass both key and value as "avro". while selecting that option, kafka message key shows as "

${avro:decode(record:attribute('avroKeySchema'),base64:decodeBytes(record:attribute('<messsage key attribute name')))}

documentation says, don't change the first part and second part should be message key attribute.. trying to figure out what would the value for these 2 attributes, as I have tried many options and pipeline is failing and unable to write to kafka.

error I receive is, 

CTRCMN_0100 - Error evaluating expression ${avro:decode(record:attribute('RetailPartnerCase'),base64:decodeBytes(record:attribute('accountmanagement_retailpartner_eps_case_domain_event_v1-key')))}: java.lang.NullPointerException

 

so, trying to understand, what I can pass into those 2 attributes? 


3 replies

Userlevel 5
Badge

@dima @Rishi 

@dima @Rishi  any updates/thoughts on this? 

Userlevel 4
Badge

@sgarg is avro key & value both are embedded as SDC Record's Attributes ? or you have schema registry (i.e Confluent schema registry ) ? Can you preview and check the value of SDC record before Kafka producer

Reply