sijie commented on a change in pull request #3904: [go schema] support go 
schema for pulsar-client-go
URL: https://github.com/apache/pulsar/pull/3904#discussion_r276522865
 
 

 ##########
 File path: pulsar-client-go/pulsar/c_producer.go
 ##########
 @@ -212,10 +237,22 @@ func pulsarProducerSendCallbackProxy(res 
C.pulsar_result, message *C.pulsar_mess
 }
 
 func (p *producer) SendAsync(ctx context.Context, msg ProducerMessage, 
callback func(ProducerMessage, error)) {
+       if p.schema != nil {
+               if msg.Value == nil {
+                       callback(msg, errors.New("message value is nil, please 
check"))
+                       return
+               }
+               payLoad, err := p.schema.Serialize(msg.Value)
+               if err != nil {
+                       callback(msg, errors.New("serialize message value 
error, please check"))
+                       return
+               }
+               msg.Payload = payLoad
+       }
 
 Review comment:
   @wolfstudy it seems that this comment was not addressed. did you miss this 
one?

----------------------------------------------------------------
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:
us...@infra.apache.org


With regards,
Apache Git Services

Reply via email to