xuesong172500 opened a new issue #6929:
URL: https://github.com/apache/pulsar/issues/6929
**Describe the bug**
A clear and concise description of what the bug is.
Use KeyValue schema in Producer
Producer<KeyValue<Student, Student>> producer =
client.newProducer(
KeyValueSchema.of(Schema.JSON(Student.class),
Schema.JSON(Student.class)))
.topic("persistent://public/default/test-kvin2")
.producerName("producerTest").create();
Function code:
public class PulsarFunctionTest3 implements Function<KeyValue<Student,
Student>, KeyValue<Student, Student>> {
@Override
public KeyValue<Student, Student> process(KeyValue<Student, Student>
studentKeyValue, Context context) throws Exception {
context.getLogger().info("studentKeyValue key: {}",
studentKeyValue.getKey().toString());
context.getLogger().info("studentKeyValue: {}",
studentKeyValue.toString());
return studentKeyValue;
}
}
Pulsar Function log shows:
java.util.concurrent.CompletionException:
org.apache.pulsar.client.api.PulsarClientException$IncompatibleSchemaException:
Key schemas or Value schemas are different schema type, from key schema type is
JSON and to key schema is BYTES, from value schema is JSON and to value schema
is BYTES
**To Reproduce**
Steps to reproduce the behavior:
1. Go to '...'
2. Click on '....'
3. Scroll down to '....'
4. See error
**Expected behavior**
A clear and concise description of what you expected to happen.
**Screenshots**
If applicable, add screenshots to help explain your problem.
**Desktop (please complete the following information):**
- OS: [e.g. iOS]
**Additional context**
Add any other context about the problem here.
----------------------------------------------------------------
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]