Gleiphir2769 commented on PR #880:
URL: https://github.com/apache/pulsar-client-go/pull/880#issuecomment-1299675160
It can be easily reproduced by following.
```
func TestSchemaStuck(t *testing.T) {
client, err := NewClient(ClientOptions{
URL: lookupURL,
})
assert.NoError(t, err)
defer client.Close()
schema1 := NewAvroSchema(`{"fields":
[
{"name":"id","type":"int"},{"default":null,"name":"name","type":["null","string"]}
],
"name":"MyAvro3","namespace":"PulsarTestCase","type":"record"}`, nil)
schema2 := NewAvroSchema(`{"fields":
[
{"name":"id","type":"int"},{"default":null,"name":"name","type":["null","string"]},
{"default":null,"name":"age","type":["null","int"]}
],"name":"MyAvro3","namespace":"PulsarTestCase","type":"record"}`, nil)
v1 := map[string]interface{}{
"id": 1,
"name": map[string]interface{}{
"string": "aac",
},
}
v2 := map[string]interface{}{
"id": 1,
"name": map[string]interface{}{
"string": "test",
},
"age": map[string]interface{}{
"int": 10,
},
}
topic := newTopicName()
producer, err := client.CreateProducer(ProducerOptions{
Topic: topic,
Schema: schema1,
DisableMultiSchema: true,
})
assert.NoError(t, err)
assert.NotNil(t, producer)
defer producer.Close()
for i := 0; i < 10; i++ {
var messageContent []byte
var key string
var schema Schema
if i%2 == 0 {
messageContent, err = schema1.Encode(v1)
key = "v1"
schema = schema1
assert.NoError(t, err)
} else {
messageContent, err = schema2.Encode(v2)
key = "v2"
schema = schema2
assert.NoError(t, err)
}
_, err = producer.Send(context.Background(), &ProducerMessage{
Payload: messageContent,
Key: key,
Schema: schema,
})
}
producer.Flush()
}
```
--
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.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]