wolfstudy 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_r276226983
########## 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: yes, this is a good idea, but just an idea. in `SchemaInfo` struct, we may define a variety of types, such as: map. In c language, don't support `map`, of course, we can implement a map by ourselves or use `std::map` to implement it. But the biggest question is: how do we pass the map type of go to c? Go's built-in map is implemented in runtime. The implementation details are not exported. Even if it is exported, its memory is managed by GC. How to ensure that c code is used, it is not recycled. So far, I have not thought of a good way to deal with this problem. ---------------------------------------------------------------- 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