hanguyen6 opened a new issue #9466:
URL: https://github.com/apache/pulsar/issues/9466
I am trying to build a generic record from JSON schema dynamically using
SchemaBuilder and RecordBuilder.
Below is the code snippet
`
val recordBuilder = SchemaBuilder.record("testJson")
recordBuilder.field("eventType").type(SchemaType.STRING)
val si: SchemaInfo = recordBuilder.build(SchemaType.JSON)
val pulsarSchema = org.apache.pulsar.client.api.Schema.generic(si)
`
`
val builder: GenericRecordBuilder = pulsarSchema.newRecordBuilder()
builder.set("eventType", "test")
val pulsarGenericRecord: GenericRecord = builder.build()`
And got this exeception (Pulsar version 2.6.1)
`Json Schema doesn't support record builder yet
java.lang.UnsupportedOperationException: Json Schema doesn't support record
builder yet
at
org.apache.pulsar.client.impl.schema.generic.GenericJsonSchema.newRecordBuilder(GenericJsonSchema.java:78)`
Is there other way to build this generic record from JSON schema other than
using POJO class ?
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]