zerocode: Problem working with Kafka messages with Record keys in Zerocode version 1.3.28 and later

Hi.

I have been executing kafka tests on older versions of kafka without having any issues but recently tried upgrading to more recent version - but have hit a problem when kafka messages with a key (containing dashes) is present.

ava.lang.RuntimeException: ZeroCode Step execution failed. Details:java.lang.RuntimeException: com.fasterxml.jackson.core.JsonParseException: Unexpected character ('a' (code 97)): Expected space separating root-level values at [Source: (String)"326e9aff-9767-46a9-a5e9-22c339389da7"; line: 1, column: 7]

The record has uses a request id as the key

Record Key - 326e9aff-9767-46a9-a5e9-22c339389da7 , Record value - {"request_id": "326e9aff-9767-46a9-a5e9-22c339389da7" .... }

The messages are processed fine with 1.3.27 - so something must have changed in the 1.3.28 version which is leading to this exception.

Could anyone advise what might be the problem?

I found something online which possibly might be related (similar error returned) https://discuss.aerospike.com/t/root-level-value-error-when-using-aerospike-inbound-kafka-connector-with-librdkafka/6903

About this issue

  • Original URL
  • State: closed
  • Created 4 years ago
  • Comments: 19 (2 by maintainers)

Most upvoted comments

Hi.

Running on 1.3.43 appears to have a fix in for the issue. Running on 1.3.44 is also fine.

Looking at the closed issues - i think the following issue was similar to my one.

https://github.com/authorjapps/zerocode/issues/657

Some entries in logs now when running the test.

2024-09-18 11:32:12,265 [main] INFO  org.jsmart.zerocode.core.kafka.helper.KafkaConsumerHelper - >>>The key was not in a parsable JSON format:b98bd601-f442-482c-8197-bb1caa93318d
2024-09-18 11:32:12,266 [main] INFO  org.jsmart.zerocode.core.kafka.helper.KafkaConsumerHelper - >>>Converting the key to JSON format for to able to read it

Thanks to everyone for you assistance. I think this issue can be closed.

ok. Understood @omkar-shitole. Thanks for explaining this. I think, it’s 1.3.43 (not 1.3.35) version onwards has got this “isKeyParseableAsJson()” method. But you’re right, let’s wait for “@bfarrell-ibm” to confirm if this resolves the issue.

We can do couple of things now:

  1. Keep this PR parked (don’t delete it for now, let it be opened for few more weeks until we are fully sure about the fix)
  2. Raise a new PR with the Unit tests(also if you would like cover with few more tests, feel free to do that)
  3. @bfarrell-ibm : Can you pls use 1.3.44 (latest as of 17/Sep/24) version, and confirm that your issue has been resolved? – Release(1.3.43) Details here: https://github.com/authorjapps/zerocode/releases/tag/1.3.43 – Once you confirm, we will act accordingly

Yes. By referring to version 1.3.35, I mean to highlight a particular exception observed in the attached log file of the error stack in https://github.com/authorjapps/zerocode/issues/557#issuecomment-1816327627 belongs to 1.3.35 is handled by this isKeyParseableAsJson() method inclusion in 1.3.43 . This exception was thrown at the reaTree() method when no appropriate string format is passed in the argument. For such cases, writeValueAsString() is a way to deal more adequately. I’ll keep PR pending and will raise a new one for test case inclusion to cover such cases.