-
Notifications
You must be signed in to change notification settings - Fork 89
Description
Hello,
I am trying to use xk6-kafka with Avro format.
It is fine for me to use this example https://github.com/mostafa/xk6-kafka/blob/main/scripts/test_avro_no_schema_registry.js
But if I did a small modification on the code with avro union type (because in our case, we use union type) as the following
const valueSchema = JSON.stringify({
type: "record",
name: "Value",
namespace: "dev.mostafa.xk6.kafka",
fields: [
{
name: "name",
type : ["null", "string"],
default: null
},
],
});
export default function () {
for (let index = 0; index < 2; index++) {
let messages = [
{
value: schemaRegistry.serialize({
data: {
name: "xk6-kafka",
},
schema: { schema: valueSchema },
schemaType: SCHEMA_TYPE_AVRO,
}),
},
];
writer.produce({ messages: messages });
}
it will report error
executor=constant-vus scenario=sasl_auth source=stacktrace ERRO[0005] GoError: Failed to encode data, OriginalError: %!w(*errors.errorString=&{cannot decode textual record "dev.mostafa.xk6.kafka.Value": cannot decode textual union: expected: '{'; actual: '"' for key: "name"})
Not sure is this issue related to my code or this plugin. Could you help on it?
Thanks.