In the VMware GemFire® Management Console™, the Functions tab allows users to deploy and view functions.
A function is a body of code that resides on a server and that an application can invoke from a client or from another server without the need to send the function code itself. The caller can direct a data-dependent function to operate on a particular dataset, or can direct a data-independent function to operate on a particular server, member, or member group.
The function execution service provides solutions for a variety of use cases, including:
An application needs to perform an operation on the data associated with a key. A registered server-side function can retrieve the data, operate on it, and put it back, with all processing performed locally to the server.
An application needs to initialize some of its components once on each server, which might be used later by executed functions.
A third-party service, such as a messaging service, requires initialization and startup.
Any arbitrary aggregation operation requires iteration over local data sets that can be done more efficiently through a single call to the cache server.
An external resource needs provisioning that can be done by executing a function on a server.
For more information about functions, see the following topics in the GemFire product documentation:
Use the Deploy Function button to deploy JAR files containing functions to all members in your cluster. Deployed functions appear in the Functions tab. The JAR files containing deployed functions appear in the Configuration tab.
When you deploy a function, the function is automatically registed with the Function Service. If the same function is deployed from another JAR file, either with the same JAR filename or another filename, the new implementation of the function is registered, overwriting the existing function.
To deploy a function:
Open the Function tab.
Click Deploy Function.
Browse to and select the JAR file containing a function to deploy. Click Open. Once deployed, you see a confirmation screen showing the name and location of the deployed files. Click Close.
The Function tab now displays the names of the deployed function and on which members the function has been deployed.
To execute a function:
Open the Function tab.
For the function that you want to execute, click the three vertically aligned dots located to the left of the function name.
Select Execute Function.
In the Execute Function interface:
Select the scope of the execution. You can execute the function on specific members, all members, or by region.
(Optional) Add arguments to the function in a comma-separated string format, with no spaces between the arguments. For example, arg1,arg2,arg3
.
(Optional) Add the fully-qualified classname of a ResultsCollector to instantiate for gathering results.
(Optional - On Region Only) Filter the keys that you want to execute the function against.
Click Execute Function.
To remove a function from the registration service:
Open the Function tab.
For the function that you want to unregister, click the three vertically aligned dots located to the left of the name of the function.
Select Unregister Function.
In the Unregister Function confirmation window, confirm that the name of the function is correct, then click Unregister.