wuchenxi123 commented on pull request #11112:
URL: https://github.com/apache/pulsar/pull/11112#issuecomment-877573226


   > Some of my thoughts:
   > 
   > 1. If we are going to introduce new methods or stages in the lifecycle of 
a function such as "open" and "close",  I would recommend we follow what we 
already have for Pulsar IO sources and Sink so that we are consistent.
   > 2. I am also not a particular fan of the name "HookFunction".  Can we call 
it "RichFunction"?  This naming is consistent with other projects such as 
Apache Storm and Flink.
   > 3. In regards to the topic
   > 
   > If this rule must be followed, then one possible way is we define a 
separate `HookFunction` interface which includes `setup`, `process`, `tearDown` 
methods, and add support in the new runtime to handle this interface. Just as 
currently the runtime handles `pulsar.Function` and `java.util.Function` 
separately. The old runtime will not be able to recognize the new interface and 
thus won't execute functions which need initialization.
   > 
   > I would rather not define a completely new interface. Ideally we have a 
"RichFunction" interface that extends the existing. So that we can minimize 
interface duplication and if we want to introduce new interfaces in the future 
we can build on top of that. In regards to the issue about the old runtime 
executing a function that implements the new interface, is it sufficient to 
document somewhere that the worker has to be updated to a certain version to 
run the functions that implement the new interface?
   
   I agree with your point of view, and made the corresponding changes, please 
codereview


-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to