-
Notifications
You must be signed in to change notification settings - Fork 171
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[improve][docs] Add schema compatibility between Go and Java client #656
Conversation
@BewareMyPower @shibd |
], | ||
"name":"MyAvro","namespace":"schemaNotFoundTestCase","type":"record"}`, nil) | ||
// Not compatible with defining a schema in Java |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does this refer to the following Java example?
If the Go Client is used like this, the Java client should also support it, right?
In java client, there are two ways:
- Use SchemaDefinition to set schema JsonDef
String jsonDef = "{"fields":[{"name":"id","type":"int"},{"default":null,"name":"name","type":["null","string"]}],"name":"MyAvro","namespace":"schemaNotFoundTestCase","type":"record"}"
Schema schema = Schema.AVRO(SchemaDefinition.builder().withJsonDef("").build());
- Or, to set not allow field is null.
SchemaDefinition<Example> schemaDefinition =
SchemaDefinition.builder().withPojo(Example.class).withAlwaysAllowNull(false).build();
Schema schema = Schema.AVRO(schemaDefinition);
Producer<Example> producer = pulsarClient.newProducer(schema)
.topic(topic).create();
we should show the solution.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh, you are right.
|
||
consumerJSCompatible := NewJSONSchema(exampleSchemaDefCompatible, nil) | ||
// Not compatible with defining a schema in Java |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Which define code of Java is this incompatible with?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Like Avro, is a problem with null fields.
original PR: apache/pulsar-client-go#1056
doc
doc-required
doc-not-needed
doc-complete