adg25 opened a new issue #9922:
URL: https://github.com/apache/pulsar/issues/9922


   #### Expected behavior
   
   I would like to use the schema registry for my c++ consumers/producers with 
protobuf schemas.
   There are examples/test for AVRO and Json but not for protobuf and I'm 
seeing failures creating the producer/consumer.
   
   #### Actual behavior
   
   c++ test app output:
   ```
   2021-03-16 15:31:46.224 WARN  [140638990731008] ClientConnection:959 | 
[127.0.0.1:35056 -> 127.0.0.1:6650] Received error response from server: 
IncompatibleSchema -- req_id: 0
   2021-03-16 15:31:46.224 ERROR [140638990731008] ConsumerImpl:257 | 
[persistent://public/default/schema-publisher23, adg_sub, 0] Failed to create 
consumer: IncompatibleSchema
   ```
   
   pulsar-standalone container output:
   ```
   pulsar-standalone    | 15:41:43.175 [ForkJoinPool.commonPool-worker-1] WARN  
org.apache.pulsar.broker.service.ServerCnx - 
[/10.0.2.2:45928][persistent://public/default/schema-publisher23][adg_sub] 
Failed to create consumer: Invalid schema definition data for PROTOBUF schema
   ```
   
   #### Steps to reproduce
   
   Code snippet:
   ```
   void createConsumer()
   {
       /*
           message MyProto{
               int a = 1;
               double b = 2;
           }
       */
     ::pulsar::Client client("pulsar://0.0.0.0:6650");
     ::pulsar::ConsumerConfiguration config;
     MyProto msg{};
     msg.set_a(22);
     msg.set_b(1.0);
     std::string msgJson;
     google::protobuf::util::MessageToJsonString(msg, &msgJson);
     ::pulsar::SchemaInfo schema(::pulsar::SchemaType::PROTOBUF, "Protobuf", 
msgJson);
     config.setSchema(schema);
     ::pulsar::Consumer consumer;
     auto result = 
client.subscribe("persistent://public/default/schema-publisher23", "adg_sub",
                                    config, consumer);
   }
   ```
   
   
   #### System configuration
   Using pulsar-standalone docker image
   


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


Reply via email to