[ https://issues.apache.org/jira/browse/KAFKA-8218?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16815505#comment-16815505 ]
Matthias J. Sax commented on KAFKA-8218: ---------------------------------------- Check out the FAQ for this error: [https://cwiki.apache.org/confluence/display/KAFKA/FAQ#FAQ-WhydoIgetanIllegalStateExceptionwhenaccessingrecordmetadata?] I seem to be a user error. Can you confirm my suspicion and close the ticket as "not a bug" if I am right. Otherwise, please provide more information. > IllegalStateException while accessing context in Transformer > ------------------------------------------------------------ > > Key: KAFKA-8218 > URL: https://issues.apache.org/jira/browse/KAFKA-8218 > Project: Kafka > Issue Type: Bug > Components: streams > Affects Versions: 2.1.1 > Reporter: Bartłomiej Kępa > Priority: Major > > Custom Kotlin implementation of Transformer throws > {code} > java.lang.IllegalStateException: This should not happen as headers() should > only be called while a record is processed > {code} > while being plugged into the stream topology that actually works. Invocation > of transform() method has valid arguments (Key and GenericRecord). > The exception is being thrown because in our implementation of transform we > need to access headers from context. > {code:java} > override fun transform(key: String?, value: GenericRecord): > KeyValue<String?, GenericRecord> { > val headers = context.headers() > ... > } > {code} -- This message was sent by Atlassian JIRA (v7.6.3#76005)