You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pulsar.apache.org by GitBox <gi...@apache.org> on 2021/11/23 19:17:43 UTC

[GitHub] [pulsar] zhavir opened a new issue #12949: Use Protobuf as schema registry for python client

zhavir opened a new issue #12949:
URL: https://github.com/apache/pulsar/issues/12949


   **Is your enhancement request related to a problem? Please describe.**
   I was wondering if there was a possibility to use protobuf in order to auto-generate code for my pulsar client services (both producer and consumer). By reading documentation and searching on the internet I was able to find some references related to other languages (like Java or C). 
   
   **Describe the solution you'd like**
   I've tried to do something like that, obviously without success.
   ```
   import _pulsar
   from pulsar import Client
   from pulsar.schema import Schema
   
   from generated_schema.test_pb2 import TodoList
   
   
   class ProtobufSchema(Schema):
       def __init__(self, record_cls):
           super(ProtobufSchema,
                 self).__init__(record_cls, _pulsar.SchemaType.PROTOBUF, <IdontKnwoHowToGetTheSchema>,
                                'PROTOBUF')
   
       def encode(self, obj):
           self._validate_object_type(obj)
           return obj.SerializeToString()
   
       def decode(self, data):
           return self._record_cls.FromString(data)
   
   
   def test():
       client = Client('pulsar://localhost:6650')
       producer = client.create_producer(topic='persistent://cloudacademy/accounts/sso-configuration-updated.v1',
                                         schema=ProtobufSchema(TodoList))
   
       producer.send(TodoList(owner_id=1, owner_name='test'))
   ```
   
   
   **Additional context**
   For a reference, I'm expecting something like the integration with Avro, but instead with Protobuf (with autogenerated classes)
   


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

To unsubscribe, e-mail: commits-unsubscribe@pulsar.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [pulsar] github-actions[bot] commented on issue #12949: Use Protobuf as schema registry for python client

Posted by GitBox <gi...@apache.org>.
github-actions[bot] commented on issue #12949:
URL: https://github.com/apache/pulsar/issues/12949#issuecomment-1052936446


   The issue had no activity for 30 days, mark with Stale label.


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

To unsubscribe, e-mail: commits-unsubscribe@pulsar.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org