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_r275130811
 
 

 ##########
 File path: pulsar-client-go/pulsar/c_consumer.go
 ##########
 @@ -109,6 +112,24 @@ func subscribeAsync(client *client, options 
ConsumerOptions, callback func(Consu
                C.pulsar_consumer_set_subscription_initial_position(conf, 
C.initial_position(options.SubscriptionInitPos))
        }
 
+       if schema != nil {
+               if schema.GetSchemaInfo().Type != NONE {
+                       cName := C.CString(schema.GetSchemaInfo().Name)
+                       cSchema := C.CString(schema.GetSchemaInfo().Schema)
+                       defer C.free(unsafe.Pointer(cName))
+                       defer C.free(unsafe.Pointer(cSchema))
+                       C.pulsar_consumer_configuration_set_schema_type(conf, 
C.pulsar_schema_type(schema.GetSchemaInfo().Type),
 
 Review comment:
   following the comment I had above, if you have a method 
`pulsar_consumer_configuration_set_schema_info`, you can just convert a go 
`SchemaInfo` to a cpp `SchemaInfo`, correct? In this way, the properties will 
not be lost. Also in future, if we introduce new fields to `SchemaInfo`, they 
can be handled correctly in one place, without touching producer and consumer 
configuration in cpp again.

----------------------------------------------------------------
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]


With regards,
Apache Git Services

Reply via email to