Colocated Code

XAPClosed and XAP SkylineClosed support multiple ways and customization options to facilitate developers who wish to run colocated code to enable efficient processing of data.

The table below contains the APIs which are supported.

API Description Consider Using When Reference
Change API

When client apps need to update SpaceClosed data, they don't have to fetch the data and then update it. Instead, they specify what changes they want to make and for which objects using SQLQuery. These changes are then carried out within the JVMClosed that stores the data. There are standard ways to make changes, like increasing a value 'increment' or setting a new one 'set value' or a property. You can also write custom code to define specific changes. This custom code can be updated while the program is running as it supports versioning.

This should be used when there is no need to bring the entire object to the client, when there is a need to simply send an instruction (via a query) from the client application to change specifically chosen objects in the Space.

Change API Overview
Remote Services

Initiate a predefined service from the client side that operates embedded within the JVM which stores the data. For example, you have a code that performs calculations, but you just want to get the results of those calculations that will be performed in the partitions.

These are used when you have predefined code that you want to trigger from the client that will run at the server side. Space Based Remoting Overview
Task / Distributed Task

Allow the client to send dynamic code on-the-fly to run within the stored data. This is different from the remote service, which declared the service in advance, whereas this is not done in this case.

Information is gathered from all partitions of the data and an action is performed on it from the client's side to allow reducing it (MapReduceClosed). For instance, if you want to take the top objects (for instance, orders that were the most expensive), you will get the most expensive orders from each partition and in the client they will be sorted to get the highest one. Different versions of the code can run in parallel.  

 

As this is a more efficient way of performing operations. This should be used when several operations are required and we want to avoid multiple remoting calls.

 

 

 

The difference between Task and Aggregation is that Tasks is performing whatever you want with different types and calculations on different classes.

Task Execution Overview

Aggregations

An API which allows the client to ask for data aggregation. The request is automatically sent to each data node that performs the aggregation and the results are sent to the client. The client then retrieves the results from all nodes and reduces them to provide the required answer. This API can handle common types of combining data, like sum, average, min and max. Plus, you can even write your own way of combining data if you want. It's flexible too, supporting different versions of code running at the same time and letting you change the code without causing any downtime.

Use when aggregated data is required out of one table type

 

The difference between Aggregation and Task is that Aggregation only iterates over one type of an actual in-memory representation of the object. Using aggregations should be preferred over executing as a task when applicable. This will increase performance as t will not necessitate the creation of an object.

Aggregators
Event Driven

This API lets you run logic embedded with your data whenever that data changes.

This is used when you have workflows that are related to changing the data in the Space.  For example, every time an order arrives, you want to perform a certain logical action. Event Processing
Business Logic BeansClosed

Allows definition of custom Java beans that will run together with the data. These beans can then trigger actions on the data based on whether they're the main source (primary) or a backup.

This is used in your application code, when you need to trigger certain code for certain situations.  For example, there is a bean that is related to a database that needs to be triggered when something needs to be read from the database.

Space Mode Context Loader

The Space Notification

JDBCClosed V3 API

Supports ANSI SQL which is implemented in a way that filters required data in each partition. Then, only the required data is supplied to the client for further reducing on the client side.

This is used to query the data in the Space using familiar SQL APIs. SQL Supported Syntax
Local View / Local Cache

When a client needs nearby data, it can define a local view that replicates data based on specifically defined (at the time) filters. This allows the client's code to run using local data. Additionally, a local cache will store data based on how often it is used.

This is used when a client needs to use specific portions of the data frequently to avoid remoting and to ensure efficiency.

Local View

Local Cache