I can create the schema (Descriptors.Descriptor
) at runtime dynamically using FileDescriptorProto
, also I'm able to serialize and deserialize messages using DynamicMessage.
However performance of DynamicMessage
is not good enough because of the way it constructs the messages. I wonder whether it's possible to compile the schema at runtime and use it when de-serializing messages for better performance.
If protocol buffers doesn't provide a way to compile the schemas at runtime then if it's possible to convert the Descriptors.Descriptor
to a temporary .proto file then I can try to generate the classes by calling protoc
command from my program and load them to the program using Class.forName API.