Closed Tobolov closed 7 months ago
@Tobolov , understood the issue.
objectMapper.readTree(keyStr)
as you have spotted.Just checking about your test usecase, did you produce the messages that way(mentioned in No. 1) or another application has produced that way, then you are only consuming?
Thanks for the swift reply @authorjapps! Yep, issue correctly identified.
I first identified the issue when I had another application produce a record with an alpha-number key and a JSON value in response to a HTTP request.
That said, I will have also have tests quite similar in nature to the one included in the bug report. The only notable difference being the key will be some-prefix-${RANDOM.UUID}
.
Thanks for the swift reply @authorjapps! Yep, issue correctly identified.
I first identified the issue when I had another application produce a record with an alpha-number key and a JSON value in response to a HTTP request.
That said, I will have also have tests quite similar in nature to the one included in the bug report. The only notable difference being the key will be
some-prefix-${RANDOM.UUID}
.
@Tobolov , we will be sorting this out soon in the next release.
Until the fix is in place, the below work-around could be used(temporarily fix only if feasible) : While producing(either your test scenario or another application), produce like this: e.g.
"key": "\"ALPHA-001\"",
instead of "key": "ALPHA-001",
I am aware that this may not be very convinient if the message is produced by another application(internal or external to your system), but may be an alternative(for temporarily until the PR is merged) if your one of your test step is doing the PRODUCE
.
A working example is here for reference, for the the this test scenario.
TODO: Documentation: Update here.
Available in version: 1.3.43
.
Release Details: https://github.com/authorjapps/zerocode/releases/tag/1.3.43
When consuming a Kafka records with
recordType: JSON
, records with a plain string as a the key can't be deserialized.Scenario to reproduce:
Exception:
Root cause: On KafkaConsumerHelper.java#L307, we run
JsonNode keyNode = objectMapper.readTree(keyStr);
. This expects the key to be a supported JSON element. The value1dd2e6c2-9d40-4c75-b735-c83911b6b652
is not a supported JSON element, however"1dd2e6c2-9d40-4c75-b735-c83911b6b652"
would be.JSON equivalent: