diff --git a/pulsar-functions/api-java/src/main/java/org/apache/pulsar/functions/api/BaseContext.java b/pulsar-functions/api-java/src/main/java/org/apache/pulsar/functions/api/BaseContext.java index d2d0b3e719547..4bd65a1c701cd 100644 --- a/pulsar-functions/api-java/src/main/java/org/apache/pulsar/functions/api/BaseContext.java +++ b/pulsar-functions/api-java/src/main/java/org/apache/pulsar/functions/api/BaseContext.java @@ -19,6 +19,7 @@ package org.apache.pulsar.functions.api; import org.apache.pulsar.client.api.ClientBuilder; +import org.apache.pulsar.client.api.PulsarClient; import org.apache.pulsar.common.classification.InterfaceAudience; import org.apache.pulsar.common.classification.InterfaceStability; import org.slf4j.Logger; @@ -193,6 +194,18 @@ default S getStateStore(String tenant, String ns, String */ void recordMetric(String metricName, double value); + /** + * Get the pre-configured pulsar client. + * + * You can use this client to access Pulsar cluster. + * The Function will be responsible for disposing this client. + * + * @return the instance of pulsar client + */ + default PulsarClient getPulsarClient() { + throw new UnsupportedOperationException("not implemented"); + } + /** * Get the pre-configured pulsar client builder. *