Functions

In the VMware GemFire® Management Console™, the Functions tab allows users to deploy and view functions.

Functions Overview

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:


Deploy a Function

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:

  1. Open the Function tab.

  2. Click Deploy Function.

    arrow pointing towards Deploy Functions on Functions tab

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

    name and location of deployed JAR files

  4. The Function tab now displays the names of the deployed function and on which members the function has been deployed.

    Functions tabs showing deployed functions


Execute a Function

To execute a function:

  1. Open the Function tab.

  2. For the function that you want to execute, click the three vertically aligned dots located to the left of the function name.

    vertical dots to the left of the function name

  3. Select Execute Function.

    Execute Function option

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

    function execution input interface

  5. Click Execute Function.


Unregister a Function

To remove a function from the registration service:

  1. Open the Function tab.

  2. For the function that you want to unregister, click the three vertically aligned dots located to the left of the name of the function.

    vertical dots to the left of the name of the function

  3. Select Unregister Function.

    Unregister Function option

  4. In the Unregister Function confirmation window, confirm that the name of the function is correct, then click Unregister.

check-circle-line exclamation-circle-line close-line
Scroll to top icon