freeznet commented on a change in pull request #14315:
URL: https://github.com/apache/pulsar/pull/14315#discussion_r809638662



##########
File path: site2/docs/functions-develop.md
##########
@@ -100,7 +103,47 @@ func main() {
 }
 ```
 For complete code, see 
[here](https://github.com/apache/pulsar/blob/77cf09eafa4f1626a53a1fe2e65dd25f377c1127/pulsar-function-go/examples/inputFunc/inputFunc.go#L20-L36).
+<!--END_DOCUSAURUS_CODE_TABS-->
+
+### Extended Pulsar Function SDK for Java
+This extended Pulsar Function SDK provides two additional interfaces to 
initialize and release external resources.
+- By using the `initialize` interface, you can initialize external resources 
which only need one-time initialization when the function instance starts.
+- By using the `close` interface, you can close the referenced external 
resources when the function instance closes. 
+
+> **Note**
+>
+> The extended Pulsar Function SDK for Java is available in Pulsar 2.10.0 and 
later versions.
+> Before using it, you need to set up Pulsar Function worker 2.10.0 or later 
versions.
+
+The following example uses the extended interface of Pulsar Function SDK for 
Java to initialize RedisClient when the function instance starts and release it 
when the function instance closes.
+
+<!--DOCUSAURUS_CODE_TABS-->
+<!--Java-->
+```Java
+import org.apache.pulsar.functions.api.Context;
+import org.apache.pulsar.functions.api.Function;
 
+public class InitializableFunction implements Function<String, String> {
+    private RedisClient client;

Review comment:
       this example seems not a complete and build-able, for example, it uses 
`RedisClient` but no import, it calls `init` but havnt declared, so would you 
please fix this example to be a build and runnable code? thanks.




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