This page describes an older version of the product. The latest stable version is 15.2.

Processing Services

In this part of the tutorial we will introduce you to the different processing services you can run on top of the space.
XAP includes a set of built-in service components such as Task Execution and Messaging services, each implementing commonly used Enterprise integration patterns.
It’s purpose is to make the implementation of distributed applications on-top of the space simpler and less intrusive and allow you to easily build highly scalable and performing applications.

Task Execution

Task Execution provides a fine-grained API for performing ad-hoc parallel execution of user defined tasks. This framework should be used in the following scenarios:

When the tasks are defined by clients and can be changed or added while the data-grid servers are running.

As a dynamic “stored procedure” enabling to execute complex multi stage queries or data manipulation where the data resides, thus enabling to send back only the end result of the calculation and avoid excess network traffic.

Scatter/Gather pattern - when you need to perform aggregated operations over a cluster of distributed partitions.

Here is an example of a task. We define a task that will collect all users that made a payment to a specific merchant:

A space task needs to be serializable because it is being serialized and reconstructed at the node.

Distributed Task

A DistributedTask is a task that ends up executing more than once (concurrently) and returns a result that is a reduced operation of all the different executions.

In the example below we are creating a distributed task that finds all merchants with a specific category. Once all results are returned to the client, reduce is called and a list of all merchants is created.

public void executeDistributedTask(){
MerchantByCategoryTask task = new MerchantByCategoryTask(
ECategoryType.AUTOMOTIVE);
//Execute the task on all the primary nodes with in the cluster
List<Merchant> result = proxy.Execute(task);
}

Asynchronous Task

A space task can also be executed asynchronously with the corresponding BeginExecuteEndExecute method. This follows the standard .NET asynchronous API, once the execution is complete the execute invoker is notified by the async result which is received from the BeginExecute method or to a supplied callback. This will be similar to executing a task in a separate thread, allowing to continue local process while waiting for the result to be calculated at the space nodes.