Class ScopeEventingFunctionManager
EventingFunctions
.-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
deployFunction
(String name) Deploys anEventingFunction
identified by its name.void
deployFunction
(String name, DeployFunctionOptions options) Deploys anEventingFunction
identified by its name with custom options.void
dropFunction
(String name) Removes aEventingFunction
by its name if it exists.void
dropFunction
(String name, DropFunctionOptions options) Removes aEventingFunction
by its name if it exists with custom options.Retrieves helpful status information about all functions currently created on the cluster.functionsStatus
(FunctionsStatusOptions options) Retrieves helpful status information about all functions currently created on the cluster with custom options.Retrieves allEventingFunctions
currently stored on the server.getAllFunctions
(GetAllFunctionsOptions options) Retrieves allEventingFunctions
currently stored on the server with custom options.getFunction
(String name) Retrieves aEventingFunction
by its name.getFunction
(String name, GetFunctionOptions options) Retrieves aEventingFunction
by its name with custom options.void
pauseFunction
(String name) Pauses anEventingFunction
identified by its name.void
pauseFunction
(String name, PauseFunctionOptions options) Pauses anEventingFunction
identified by its name with custom options.void
resumeFunction
(String name) Resumes anEventingFunction
identified by its name.void
resumeFunction
(String name, ResumeFunctionOptions options) Resumes anEventingFunction
identified by its name with custom options.void
undeployFunction
(String name) Undeploys anEventingFunction
identified by its name.void
undeployFunction
(String name, UndeployFunctionOptions options) Undeploys anEventingFunction
identified by its name with custom options.void
upsertFunction
(EventingFunction function) Inserts or replaces aEventingFunction
.void
upsertFunction
(EventingFunction function, UpsertFunctionOptions options) Inserts or replaces aEventingFunction
with custom options.
-
Constructor Details
-
ScopeEventingFunctionManager
Creates a newScopeEventingFunctionManager
.This API is not intended to be called by the user directly, use
Cluster.eventingFunctions()
instead.- Parameters:
asyncManager
- the underlying async manager that performs the ops.
-
-
Method Details
-
upsertFunction
Inserts or replaces aEventingFunction
.The eventing management API defines that if a function is stored which name does not exist yet, it will be inserted. If the name already exists, the function will be replaced with its new equivalent and the properties changed.
Operations which change the runtime-state of a function (i.e. deploy / undeploy / pause / resume) should not be modified through this method, but rather by using those methods directly (i.e.
deployFunction(String)
).- Parameters:
function
- the function to be inserted or replaced.- Throws:
EventingFunctionCompilationFailureException
- if the function body cannot be compiled.CollectionNotFoundException
- if the specified collection or scope does not exist.BucketNotFoundException
- if the specified bucket does not exist.EventingFunctionIdenticalKeyspaceException
- if the source and metadata keyspace are the same.CouchbaseException
- if any other generic unhandled/unexpected errors.
-
upsertFunction
Inserts or replaces aEventingFunction
with custom options.The eventing management API defines that if a function is stored which name does not exist yet, it will be inserted. If the name already exists, the function will be replaced with its new equivalent and the properties changed.
Operations which change the runtime-state of a function (i.e. deploy / undeploy / pause / resume) should not be modified through this method, but rather by using those methods directly (i.e.
deployFunction(String)
).- Parameters:
function
- the function to be inserted or replaced.options
- the custom options to apply.- Throws:
EventingFunctionCompilationFailureException
- if the function body cannot be compiled.CollectionNotFoundException
- if the specified collection or scope does not exist.BucketNotFoundException
- if the specified bucket does not exist.EventingFunctionIdenticalKeyspaceException
- if the source and metadata keyspace are the same.CouchbaseException
- if any other generic unhandled/unexpected errors.
-
getFunction
Retrieves aEventingFunction
by its name.- Parameters:
name
- the name of the function to retrieve.- Returns:
- the eventing function found.
- Throws:
EventingFunctionNotFoundException
- if the function is not found on the server.CouchbaseException
- if any other generic unhandled/unexpected errors.
-
getFunction
Retrieves aEventingFunction
by its name with custom options.- Parameters:
name
- the name of the function to retrieve.options
- the custom options to apply.- Returns:
- the eventing function found.
- Throws:
EventingFunctionNotFoundException
- if the function is not found on the server.CouchbaseException
- if any other generic unhandled/unexpected errors.
-
getAllFunctions
Retrieves allEventingFunctions
currently stored on the server.If no functions are found, an empty list is returned.
- Returns:
- eventing functions found or an empty list.
- Throws:
CouchbaseException
- if any other generic unhandled/unexpected errors.
-
getAllFunctions
Retrieves allEventingFunctions
currently stored on the server with custom options.If no functions are found, an empty list is returned.
- Parameters:
options
- the custom options to apply.- Returns:
- eventing functions found or an empty list.
- Throws:
CouchbaseException
- if any other generic unhandled/unexpected errors.
-
dropFunction
Removes aEventingFunction
by its name if it exists.Note that due to a bug on the server, depending on which version is used, both a
EventingFunctionNotFoundException
or aEventingFunctionNotDeployedException
can be thrown if a function does not exist.- Parameters:
name
- the name of the function to drop.- Throws:
EventingFunctionNotFoundException
- if the function is not found on the server.EventingFunctionNotDeployedException
- if the function is not found on the server (see above).EventingFunctionDeployedException
- if the function is currently deployed (undeploy first).CouchbaseException
- if any other generic unhandled/unexpected errors.
-
dropFunction
Removes aEventingFunction
by its name if it exists with custom options.Note that due to a bug on the server, depending on which version is used, both a
EventingFunctionNotFoundException
or aEventingFunctionNotDeployedException
can be thrown if a function does not exist.- Parameters:
name
- the name of the function to drop.options
- the custom options to apply.- Throws:
EventingFunctionNotFoundException
- if the function is not found on the server.EventingFunctionNotDeployedException
- if the function is not found on the server (see above).EventingFunctionDeployedException
- if the function is currently deployed (undeploy first).CouchbaseException
- if any other generic unhandled/unexpected errors.
-
deployFunction
Deploys anEventingFunction
identified by its name.Calling this method effectively moves the function from state
EventingFunctionDeploymentStatus.UNDEPLOYED
to stateEventingFunctionDeploymentStatus.DEPLOYED
.- Parameters:
name
- the name of the function to deploy.- Throws:
EventingFunctionNotFoundException
- if the function is not found on the server.EventingFunctionNotBootstrappedException
- if the function is not bootstrapped yet (after creating it).CouchbaseException
- if any other generic unhandled/unexpected errors.
-
deployFunction
Deploys anEventingFunction
identified by its name with custom options.Calling this method effectively moves the function from state
EventingFunctionDeploymentStatus.UNDEPLOYED
to stateEventingFunctionDeploymentStatus.DEPLOYED
.- Parameters:
name
- the name of the function to deploy.options
- the custom options to apply.- Throws:
EventingFunctionNotFoundException
- if the function is not found on the server.EventingFunctionNotBootstrappedException
- if the function is not bootstrapped yet (after creating it).CouchbaseException
- if any other generic unhandled/unexpected errors.
-
undeployFunction
Undeploys anEventingFunction
identified by its name.Calling this method effectively moves the function from state
EventingFunctionDeploymentStatus.DEPLOYED
to stateEventingFunctionDeploymentStatus.UNDEPLOYED
.Note that due to a bug on the server, depending on which version is used, both a
EventingFunctionNotFoundException
or aEventingFunctionNotDeployedException
can be thrown if a function does not exist.- Parameters:
name
- the name of the function to undeploy.- Throws:
EventingFunctionNotFoundException
- if the function is not found on the server.EventingFunctionNotDeployedException
- if the function is not found on the server (see above).CouchbaseException
- if any other generic unhandled/unexpected errors.
-
undeployFunction
Undeploys anEventingFunction
identified by its name with custom options.Calling this method effectively moves the function from state
EventingFunctionDeploymentStatus.DEPLOYED
to stateEventingFunctionDeploymentStatus.UNDEPLOYED
.Note that due to a bug on the server, depending on which version is used, both a
EventingFunctionNotFoundException
or aEventingFunctionNotDeployedException
can be thrown if a function does not exist.- Parameters:
name
- the name of the function to undeploy.options
- the custom options to apply.- Throws:
EventingFunctionNotFoundException
- if the function is not found on the server.EventingFunctionNotDeployedException
- if the function is not found on the server (see above).CouchbaseException
- if any other generic unhandled/unexpected errors.
-
pauseFunction
Pauses anEventingFunction
identified by its name.Calling this method effectively moves the function from state
EventingFunctionProcessingStatus.RUNNING
to stateEventingFunctionProcessingStatus.PAUSED
.- Parameters:
name
- the name of the function to pause.- Throws:
EventingFunctionNotFoundException
- if the function is not found on the server.EventingFunctionNotBootstrappedException
- if the function is not bootstrapped yet (after creating it).CouchbaseException
- if any other generic unhandled/unexpected errors.
-
pauseFunction
Pauses anEventingFunction
identified by its name with custom options.Calling this method effectively moves the function from state
EventingFunctionProcessingStatus.RUNNING
to stateEventingFunctionProcessingStatus.PAUSED
.- Parameters:
name
- the name of the function to pause.options
- the custom options to apply.- Throws:
EventingFunctionNotFoundException
- if the function is not found on the server.EventingFunctionNotBootstrappedException
- if the function is not bootstrapped yet (after creating it).CouchbaseException
- if any other generic unhandled/unexpected errors.
-
resumeFunction
Resumes anEventingFunction
identified by its name.Calling this method effectively moves the function from state
EventingFunctionProcessingStatus.PAUSED
to stateEventingFunctionProcessingStatus.RUNNING
.Note that due to a bug on the server, depending on which version is used, both a
EventingFunctionNotFoundException
or aEventingFunctionNotDeployedException
can be thrown if a function does not exist.- Parameters:
name
- the name of the function to resume.- Throws:
EventingFunctionNotFoundException
- if the function is not found on the server.EventingFunctionNotDeployedException
- if the function is not found on the server (see above).CouchbaseException
- if any other generic unhandled/unexpected errors.
-
resumeFunction
Resumes anEventingFunction
identified by its name with custom options.Calling this method effectively moves the function from state
EventingFunctionProcessingStatus.PAUSED
to stateEventingFunctionProcessingStatus.RUNNING
.Note that due to a bug on the server, depending on which version is used, both a
EventingFunctionNotFoundException
or aEventingFunctionNotDeployedException
can be thrown if a function does not exist.- Parameters:
name
- the name of the function to resume.options
- the custom options to apply.- Throws:
EventingFunctionNotFoundException
- if the function is not found on the server.EventingFunctionNotDeployedException
- if the function is not found on the server (see above).CouchbaseException
- if any other generic unhandled/unexpected errors.
-
functionsStatus
Retrieves helpful status information about all functions currently created on the cluster.- Returns:
- the eventing status.
- Throws:
CouchbaseException
- if any other generic unhandled/unexpected errors.
-
functionsStatus
Retrieves helpful status information about all functions currently created on the cluster with custom options.- Parameters:
options
- the custom options to apply.- Returns:
- the eventing status.
- Throws:
CouchbaseException
- if any other generic unhandled/unexpected errors.
-