Package org.apache.pulsar.client.admin
Interface Functions
public interface Functions
Admin interface for function management.
-
Method Summary
Modifier and TypeMethodDescriptionvoid
createFunction
(FunctionConfig functionConfig, String fileName) Create a new function.createFunctionAsync
(FunctionConfig functionConfig, String fileName) Create a new function asynchronously.void
createFunctionWithUrl
(FunctionConfig functionConfig, String pkgUrl) Create a new function with package url.createFunctionWithUrlAsync
(FunctionConfig functionConfig, String pkgUrl) Create a new function with package url asynchronously.void
deleteFunction
(String tenant, String namespace, String function) Delete an existing function.deleteFunctionAsync
(String tenant, String namespace, String function) Delete an existing function asynchronously.void
downloadFunction
(String destinationFile, String path) Download Function Code.void
downloadFunction
(String destinationFile, String tenant, String namespace, String function) Download Function Code.void
downloadFunction
(String destinationFile, String tenant, String namespace, String function, boolean transformFunction) Download Function Code.downloadFunctionAsync
(String destinationFile, String path) Download Function Code.downloadFunctionAsync
(String destinationFile, String tenant, String namespace, String function) Download Function Code asynchronously.downloadFunctionAsync
(String destinationFile, String tenant, String namespace, String function, boolean transformFunction) Download Function Code asynchronously.Fetches a list of supported Pulsar Functions currently running in cluster mode.Fetches a list of supported Pulsar Functions currently running in cluster mode asynchronously.Deprecated.getFunction
(String tenant, String namespace, String function) Get the configuration for the specified function.getFunctionAsync
(String tenant, String namespace, String function) Get the configuration for the specified function asynchronously.getFunctions
(String tenant, String namespace) Get the list of functions.getFunctionsAsync
(String tenant, String namespace) Get the list of functions asynchronously.getFunctionState
(String tenant, String namespace, String function, String key) Fetch the current state associated with a Pulsar Function.getFunctionStateAsync
(String tenant, String namespace, String function, String key) Fetch the current state associated with a Pulsar Function asynchronously.getFunctionStats
(String tenant, String namespace, String function) Gets the current stats of a function.getFunctionStats
(String tenant, String namespace, String function, int id) Gets the current stats of a function instance.getFunctionStatsAsync
(String tenant, String namespace, String function) Gets the current stats of a function asynchronously.getFunctionStatsAsync
(String tenant, String namespace, String function, int id) Gets the current stats of a function instance asynchronously.getFunctionStatus
(String tenant, String namespace, String function) Gets the current status of a function.getFunctionStatus
(String tenant, String namespace, String function, int id) Gets the current status of a function instance.getFunctionStatusAsync
(String tenant, String namespace, String function) Gets the current status of a function asynchronously.getFunctionStatusAsync
(String tenant, String namespace, String function, int id) Gets the current status of a function instance asynchronously.getSinks()
Deprecated.Deprecated.void
putFunctionState
(String tenant, String namespace, String function, FunctionState state) Puts the given state associated with a Pulsar Function.putFunctionStateAsync
(String tenant, String namespace, String function, FunctionState state) Puts the given state associated with a Pulsar Function asynchronously.void
Reload the available built-in functions.Reload the available built-in functions.void
restartFunction
(String tenant, String namespace, String function) Restart all function instances.void
restartFunction
(String tenant, String namespace, String function, int instanceId) Restart function instance.restartFunctionAsync
(String tenant, String namespace, String function) Restart all function instances asynchronously.restartFunctionAsync
(String tenant, String namespace, String function, int instanceId) Restart function instance asynchronously.void
startFunction
(String tenant, String namespace, String function) Start all function instances.void
startFunction
(String tenant, String namespace, String function, int instanceId) Start function instance.startFunctionAsync
(String tenant, String namespace, String function) Start all function instances asynchronously.startFunctionAsync
(String tenant, String namespace, String function, int instanceId) Start function instance asynchronously.void
stopFunction
(String tenant, String namespace, String function) Stop all function instances.void
stopFunction
(String tenant, String namespace, String function, int instanceId) Stop function instance.stopFunctionAsync
(String tenant, String namespace, String function) Stop all function instances asynchronously.stopFunctionAsync
(String tenant, String namespace, String function, int instanceId) Stop function instance asynchronously.triggerFunction
(String tenant, String namespace, String function, String topic, String triggerValue, String triggerFile) Triggers the function by writing to the input topic.triggerFunctionAsync
(String tenant, String namespace, String function, String topic, String triggerValue, String triggerFile) Triggers the function by writing to the input topic asynchronously.void
updateFunction
(FunctionConfig functionConfig, String fileName) Update the configuration for a function.void
updateFunction
(FunctionConfig functionConfig, String fileName, UpdateOptions updateOptions) Update the configuration for a function.updateFunctionAsync
(FunctionConfig functionConfig, String fileName) Update the configuration for a function asynchronously.updateFunctionAsync
(FunctionConfig functionConfig, String fileName, UpdateOptions updateOptions) Update the configuration for a function asynchronously.void
updateFunctionWithUrl
(FunctionConfig functionConfig, String pkgUrl) Update the configuration for a function.void
updateFunctionWithUrl
(FunctionConfig functionConfig, String pkgUrl, UpdateOptions updateOptions) Update the configuration for a function.updateFunctionWithUrlAsync
(FunctionConfig functionConfig, String pkgUrl) Update the configuration for a function asynchronously.updateFunctionWithUrlAsync
(FunctionConfig functionConfig, String pkgUrl, UpdateOptions updateOptions) Update the configuration for a function asynchronously.void
uploadFunction
(String sourceFile, String path) Upload Data.uploadFunctionAsync
(String sourceFile, String path) Upload Data asynchronously.
-
Method Details
-
getFunctions
Get the list of functions. Get the list of all the Pulsar functions. Response Example:["f1", "f2", "f3"]
- Throws:
PulsarAdminException.NotAuthorizedException
- Don't have admin permissionPulsarAdminException
- Unexpected error
-
getFunctionsAsync
Get the list of functions asynchronously. Get the list of all the Pulsar functions. Response Example:["f1", "f2", "f3"]
-
getFunction
FunctionConfig getFunction(String tenant, String namespace, String function) throws PulsarAdminException Get the configuration for the specified function. Response Example:{ serviceUrl : "http://my-broker.example.com:8080/" }
- Parameters:
tenant
- Tenant namenamespace
- Namespace namefunction
- Function name- Returns:
- the function configuration
- Throws:
PulsarAdminException.NotAuthorizedException
- You don't have admin permission to get the configuration of the clusterPulsarAdminException.NotFoundException
- Cluster doesn't existPulsarAdminException
- Unexpected error
-
getFunctionAsync
CompletableFuture<FunctionConfig> getFunctionAsync(String tenant, String namespace, String function) Get the configuration for the specified function asynchronously. Response Example:{ serviceUrl : "http://my-broker.example.com:8080/" }
- Parameters:
tenant
- Tenant namenamespace
- Namespace namefunction
- Function name- Returns:
- the function configuration
-
createFunction
Create a new function.- Parameters:
functionConfig
- the function configuration object- Throws:
PulsarAdminException
- Unexpected error
-
createFunctionAsync
Create a new function asynchronously.- Parameters:
functionConfig
- the function configuration object
-
createFunctionWithUrl
void createFunctionWithUrl(FunctionConfig functionConfig, String pkgUrl) throws PulsarAdminException Create a new function with package url. Create a new function by providing url from which fun-pkg can be downloaded. supported url: http/file eg: File: file:/dir/fileName.jar Http: http://www.repo.com/fileName.jar- Parameters:
functionConfig
- the function configuration objectpkgUrl
- url from which pkg can be downloaded- Throws:
PulsarAdminException
-
createFunctionWithUrlAsync
Create a new function with package url asynchronously. Create a new function by providing url from which fun-pkg can be downloaded. supported url: http/file eg: File: file:/dir/fileName.jar Http: http://www.repo.com/fileName.jar- Parameters:
functionConfig
- the function configuration objectpkgUrl
- url from which pkg can be downloaded
-
updateFunction
Update the configuration for a function.- Parameters:
functionConfig
- the function configuration object- Throws:
PulsarAdminException.NotAuthorizedException
- You don't have admin permission to create the clusterPulsarAdminException.NotFoundException
- Cluster doesn't existPulsarAdminException
- Unexpected error
-
updateFunctionAsync
Update the configuration for a function asynchronously.- Parameters:
functionConfig
- the function configuration object
-
updateFunction
void updateFunction(FunctionConfig functionConfig, String fileName, UpdateOptions updateOptions) throws PulsarAdminException Update the configuration for a function.- Parameters:
functionConfig
- the function configuration objectupdateOptions
- options for the update operations- Throws:
PulsarAdminException.NotAuthorizedException
- You don't have admin permission to create the clusterPulsarAdminException.NotFoundException
- Cluster doesn't existPulsarAdminException
- Unexpected error
-
updateFunctionAsync
CompletableFuture<Void> updateFunctionAsync(FunctionConfig functionConfig, String fileName, UpdateOptions updateOptions) Update the configuration for a function asynchronously.- Parameters:
functionConfig
- the function configuration objectupdateOptions
- options for the update operations
-
updateFunctionWithUrl
void updateFunctionWithUrl(FunctionConfig functionConfig, String pkgUrl) throws PulsarAdminException Update the configuration for a function. Update a function by providing url from which fun-pkg can be downloaded. supported url: http/file eg: File: file:/dir/fileName.jar Http: http://www.repo.com/fileName.jar- Parameters:
functionConfig
- the function configuration objectpkgUrl
- url from which pkg can be downloaded- Throws:
PulsarAdminException.NotAuthorizedException
- You don't have admin permission to create the clusterPulsarAdminException.NotFoundException
- Cluster doesn't existPulsarAdminException
- Unexpected error
-
updateFunctionWithUrlAsync
Update the configuration for a function asynchronously. Update a function by providing url from which fun-pkg can be downloaded. supported url: http/file eg: File: file:/dir/fileName.jar Http: http://www.repo.com/fileName.jar- Parameters:
functionConfig
- the function configuration objectpkgUrl
- url from which pkg can be downloaded
-
updateFunctionWithUrl
void updateFunctionWithUrl(FunctionConfig functionConfig, String pkgUrl, UpdateOptions updateOptions) throws PulsarAdminException Update the configuration for a function. Update a function by providing url from which fun-pkg can be downloaded. supported url: http/file eg: File: file:/dir/fileName.jar Http: http://www.repo.com/fileName.jar- Parameters:
functionConfig
- the function configuration objectpkgUrl
- url from which pkg can be downloadedupdateOptions
- options for the update operations- Throws:
PulsarAdminException.NotAuthorizedException
- You don't have admin permission to create the clusterPulsarAdminException.NotFoundException
- Cluster doesn't existPulsarAdminException
- Unexpected error
-
updateFunctionWithUrlAsync
CompletableFuture<Void> updateFunctionWithUrlAsync(FunctionConfig functionConfig, String pkgUrl, UpdateOptions updateOptions) Update the configuration for a function asynchronously. Update a function by providing url from which fun-pkg can be downloaded. supported url: http/file eg: File: file:/dir/fileName.jar Http: http://www.repo.com/fileName.jar- Parameters:
functionConfig
- the function configuration objectpkgUrl
- url from which pkg can be downloadedupdateOptions
- options for the update operations
-
deleteFunction
Delete an existing function. Delete a function- Parameters:
tenant
- Tenant namenamespace
- Namespace namefunction
- Function name- Throws:
PulsarAdminException.NotAuthorizedException
- You don't have admin permissionPulsarAdminException.NotFoundException
- Cluster does not existPulsarAdminException.PreconditionFailedException
- Cluster is not emptyPulsarAdminException
- Unexpected error
-
deleteFunctionAsync
Delete an existing function asynchronously. Delete a function- Parameters:
tenant
- Tenant namenamespace
- Namespace namefunction
- Function name
-
getFunctionStatus
FunctionStatus getFunctionStatus(String tenant, String namespace, String function) throws PulsarAdminException Gets the current status of a function.- Parameters:
tenant
- Tenant namenamespace
- Namespace namefunction
- Function name- Throws:
PulsarAdminException
- Unexpected error
-
getFunctionStatusAsync
CompletableFuture<FunctionStatus> getFunctionStatusAsync(String tenant, String namespace, String function) Gets the current status of a function asynchronously.- Parameters:
tenant
- Tenant namenamespace
- Namespace namefunction
- Function name
-
getFunctionStatus
FunctionStatus.FunctionInstanceStatus.FunctionInstanceStatusData getFunctionStatus(String tenant, String namespace, String function, int id) throws PulsarAdminException Gets the current status of a function instance.- Parameters:
tenant
- Tenant namenamespace
- Namespace namefunction
- Function nameid
- Function instance-id- Returns:
- Throws:
PulsarAdminException
-
getFunctionStatusAsync
CompletableFuture<FunctionStatus.FunctionInstanceStatus.FunctionInstanceStatusData> getFunctionStatusAsync(String tenant, String namespace, String function, int id) Gets the current status of a function instance asynchronously.- Parameters:
tenant
- Tenant namenamespace
- Namespace namefunction
- Function nameid
- Function instance-id- Returns:
-
getFunctionStats
FunctionInstanceStatsData getFunctionStats(String tenant, String namespace, String function, int id) throws PulsarAdminException Gets the current stats of a function instance.- Parameters:
tenant
- Tenant namenamespace
- Namespace namefunction
- Function nameid
- Function instance-id- Returns:
- Throws:
PulsarAdminException
-
getFunctionStatsAsync
CompletableFuture<FunctionInstanceStatsData> getFunctionStatsAsync(String tenant, String namespace, String function, int id) Gets the current stats of a function instance asynchronously.- Parameters:
tenant
- Tenant namenamespace
- Namespace namefunction
- Function nameid
- Function instance-id- Returns:
-
getFunctionStats
FunctionStats getFunctionStats(String tenant, String namespace, String function) throws PulsarAdminException Gets the current stats of a function.- Parameters:
tenant
- Tenant namenamespace
- Namespace namefunction
- Function name- Returns:
- Throws:
PulsarAdminException
-
getFunctionStatsAsync
CompletableFuture<FunctionStats> getFunctionStatsAsync(String tenant, String namespace, String function) Gets the current stats of a function asynchronously.- Parameters:
tenant
- Tenant namenamespace
- Namespace namefunction
- Function name- Returns:
-
restartFunction
void restartFunction(String tenant, String namespace, String function, int instanceId) throws PulsarAdminException Restart function instance.- Parameters:
tenant
- Tenant namenamespace
- Namespace namefunction
- Function nameinstanceId
- Function instanceId- Throws:
PulsarAdminException
- Unexpected error
-
restartFunctionAsync
CompletableFuture<Void> restartFunctionAsync(String tenant, String namespace, String function, int instanceId) Restart function instance asynchronously.- Parameters:
tenant
- Tenant namenamespace
- Namespace namefunction
- Function nameinstanceId
- Function instanceId
-
restartFunction
Restart all function instances.- Parameters:
tenant
- Tenant namenamespace
- Namespace namefunction
- Function name- Throws:
PulsarAdminException
- Unexpected error
-
restartFunctionAsync
Restart all function instances asynchronously.- Parameters:
tenant
- Tenant namenamespace
- Namespace namefunction
- Function name
-
stopFunction
void stopFunction(String tenant, String namespace, String function, int instanceId) throws PulsarAdminException Stop function instance.- Parameters:
tenant
- Tenant namenamespace
- Namespace namefunction
- Function nameinstanceId
- Function instanceId- Throws:
PulsarAdminException
- Unexpected error
-
stopFunctionAsync
CompletableFuture<Void> stopFunctionAsync(String tenant, String namespace, String function, int instanceId) Stop function instance asynchronously.- Parameters:
tenant
- Tenant namenamespace
- Namespace namefunction
- Function nameinstanceId
- Function instanceId
-
startFunction
Start all function instances.- Parameters:
tenant
- Tenant namenamespace
- Namespace namefunction
- Function name- Throws:
PulsarAdminException
- Unexpected error
-
startFunctionAsync
Start all function instances asynchronously.- Parameters:
tenant
- Tenant namenamespace
- Namespace namefunction
- Function name
-
startFunction
void startFunction(String tenant, String namespace, String function, int instanceId) throws PulsarAdminException Start function instance.- Parameters:
tenant
- Tenant namenamespace
- Namespace namefunction
- Function nameinstanceId
- Function instanceId- Throws:
PulsarAdminException
- Unexpected error
-
startFunctionAsync
CompletableFuture<Void> startFunctionAsync(String tenant, String namespace, String function, int instanceId) Start function instance asynchronously.- Parameters:
tenant
- Tenant namenamespace
- Namespace namefunction
- Function nameinstanceId
- Function instanceId
-
stopFunction
Stop all function instances.- Parameters:
tenant
- Tenant namenamespace
- Namespace namefunction
- Function name- Throws:
PulsarAdminException
- Unexpected error
-
stopFunctionAsync
Stop all function instances asynchronously.- Parameters:
tenant
- Tenant namenamespace
- Namespace namefunction
- Function name
-
triggerFunction
String triggerFunction(String tenant, String namespace, String function, String topic, String triggerValue, String triggerFile) throws PulsarAdminException Triggers the function by writing to the input topic.- Parameters:
tenant
- Tenant namenamespace
- Namespace namefunction
- Function nametriggerValue
- The input that will be written to input topictriggerFile
- The file which contains the input that will be written to input topic- Throws:
PulsarAdminException
- Unexpected error
-
triggerFunctionAsync
CompletableFuture<String> triggerFunctionAsync(String tenant, String namespace, String function, String topic, String triggerValue, String triggerFile) Triggers the function by writing to the input topic asynchronously.- Parameters:
tenant
- Tenant namenamespace
- Namespace namefunction
- Function nametriggerValue
- The input that will be written to input topictriggerFile
- The file which contains the input that will be written to input topic
-
uploadFunction
Upload Data.- Parameters:
sourceFile
- dataFile that needs to be uploadedpath
- Path where data should be stored- Throws:
PulsarAdminException
- Unexpected error
-
uploadFunctionAsync
Upload Data asynchronously.- Parameters:
sourceFile
- dataFile that needs to be uploadedpath
- Path where data should be stored
-
downloadFunction
Download Function Code.- Parameters:
destinationFile
- file where data should be downloaded topath
- Path where data is located- Throws:
PulsarAdminException
- Unexpected error
-
downloadFunctionAsync
Download Function Code.- Parameters:
destinationFile
- file where data should be downloaded topath
- Path where data is located
-
downloadFunction
void downloadFunction(String destinationFile, String tenant, String namespace, String function) throws PulsarAdminException Download Function Code.- Parameters:
destinationFile
- file where data should be downloaded totenant
- Tenant namenamespace
- Namespace namefunction
- Function name- Throws:
PulsarAdminException
-
downloadFunctionAsync
CompletableFuture<Void> downloadFunctionAsync(String destinationFile, String tenant, String namespace, String function) Download Function Code asynchronously.- Parameters:
destinationFile
- file where data should be downloaded totenant
- Tenant namenamespace
- Namespace namefunction
- Function name
-
downloadFunction
void downloadFunction(String destinationFile, String tenant, String namespace, String function, boolean transformFunction) throws PulsarAdminException Download Function Code.- Parameters:
destinationFile
- file where data should be downloaded totenant
- Tenant namenamespace
- Namespace namefunction
- Function nametransformFunction
- Whether to download the transform function (for sources and sinks)- Throws:
PulsarAdminException
-
downloadFunctionAsync
CompletableFuture<Void> downloadFunctionAsync(String destinationFile, String tenant, String namespace, String function, boolean transformFunction) Download Function Code asynchronously.- Parameters:
destinationFile
- file where data should be downloaded totenant
- Tenant namenamespace
- Namespace namefunction
- Function nametransformFunction
- Whether to download the transform function (for sources and sinks)
-
getConnectorsList
Deprecated.Deprecated in favor of getting sources and sinks for their own APIs. Fetches a list of supported Pulsar IO connectors currently running in cluster mode- Throws:
PulsarAdminException
- Unexpected error
-
getSources
Deprecated.Deprecated in favor of getting sources and sinks for their own APIs. Fetches a list of supported Pulsar IO sources currently running in cluster mode- Throws:
PulsarAdminException
- Unexpected error
-
getSinks
Deprecated.Deprecated in favor of getting sources and sinks for their own APIs. Fetches a list of supported Pulsar IO sinks currently running in cluster mode- Throws:
PulsarAdminException
- Unexpected error
-
getBuiltInFunctions
Fetches a list of supported Pulsar Functions currently running in cluster mode.- Throws:
PulsarAdminException
- Unexpected error
-
getBuiltInFunctionsAsync
CompletableFuture<List<FunctionDefinition>> getBuiltInFunctionsAsync()Fetches a list of supported Pulsar Functions currently running in cluster mode asynchronously. -
getFunctionState
FunctionState getFunctionState(String tenant, String namespace, String function, String key) throws PulsarAdminException Fetch the current state associated with a Pulsar Function. Response Example:{ "value : 12, version : 2"}
- Parameters:
tenant
- Tenant namenamespace
- Namespace namefunction
- Function namekey
- Key name of State- Returns:
- the function configuration
- Throws:
PulsarAdminException.NotAuthorizedException
- You don't have admin permission to get the configuration of the clusterPulsarAdminException.NotFoundException
- Cluster doesn't existPulsarAdminException
- Unexpected error
-
getFunctionStateAsync
CompletableFuture<FunctionState> getFunctionStateAsync(String tenant, String namespace, String function, String key) Fetch the current state associated with a Pulsar Function asynchronously. Response Example:{ "value : 12, version : 2"}
- Parameters:
tenant
- Tenant namenamespace
- Namespace namefunction
- Function namekey
- Key name of State- Returns:
- the function configuration
-
putFunctionState
void putFunctionState(String tenant, String namespace, String function, FunctionState state) throws PulsarAdminException Puts the given state associated with a Pulsar Function. Response Example:{ "value : 12, version : 2"}
- Parameters:
tenant
- Tenant namenamespace
- Namespace namefunction
- Function namestate
- FunctionState- Throws:
PulsarAdminException.NotAuthorizedException
- You don't have admin permission to get the configuration of the clusterPulsarAdminException.NotFoundException
- Cluster doesn't existPulsarAdminException
- Unexpected error
-
putFunctionStateAsync
CompletableFuture<Void> putFunctionStateAsync(String tenant, String namespace, String function, FunctionState state) Puts the given state associated with a Pulsar Function asynchronously. Response Example:{ "value : 12, version : 2"}
- Parameters:
tenant
- Tenant namenamespace
- Namespace namefunction
- Function namestate
- FunctionState
-
reloadBuiltInFunctions
Reload the available built-in functions.- Throws:
PulsarAdminException
- Unexpected error
-
reloadBuiltInFunctionsAsync
CompletableFuture<Void> reloadBuiltInFunctionsAsync()Reload the available built-in functions.
-