sp-davidpichler opened a new issue #8772:
URL: https://github.com/apache/pulsar/issues/8772


   
   **Is your enhancement request related to a problem? Please describe.**
   As the python pulsar client is currently written, I don't think pulsar 
functions output schema can be configured
   
   **Describe the solution you'd like**
   The user should be able to specify the output schema when deploying a 
function
   
   **Describe alternatives you've considered**
   I could write my functions like the following but would then have to 
separately apply the schema using a mock consumer or producer.
   
   ```
   from pulsar.schema import *
   from pulsar.functions.function import Function
   
   class MyRecord(Record):
       id = Integer()
       another_key = String()
   
   
   class MyFunction(Function):
   
       def __init__(self):
           self.schema = JsonSchema(XG)
   
       def process(self, message, context):
           return self.schema.encode(XG(id=message['id'], 
another_key=message['another_key']))
   ```
   
   **Additional context**
   I also took a look at 
https://github.com/apache/pulsar/blob/334dffdb95035349cc0fdbc9f84a15d2422a825b/pulsar-functions/instance/src/main/python/python_instance.py#L319-L334
 and see that no schema is set when creating the producer.
   


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


Reply via email to