Access data with client applications
After you configure the development environment, you can begin to develop applications that create, access, and manage the data in the data grid.
From the perspective of a client application, using WebSphere eXtreme Scale involves the following main steps:
- Connect to the catalog service by obtaining a ClientClusterContext instance.
- Obtaining a client ObjectGrid instance.
- Get a Session instance.
- Get an ObjectMap instance.
- Use the ObjectMap methods.
- ObjectGrid interface
The following methods allow you to interact with an ObjectGrid instance.
- BackMap interface
Each ObjectGrid instance contains a collection of BackingMap objects. Use the defineMap method or the createMap method of the ObjectGrid interface to name and add each BackingMap to an ObjectGrid instance. These methods return a BackingMap instance that is then used to define the behavior of an individual Map. A BackingMap can be considered as an in-memory cache of committed data for an individual map.
- Connect to a distributed ObjectGrid
You can connect to a distributed ObjectGrid with a connection end point for the catalog service domain. You must have the host name and listener port of each catalog server in the catalog service domain to which to connect.
- Interacting with an ObjectGrid using ObjectGridManager
The ObjectGridManagerFactory class and the ObjectGridManager interface provide a mechanism to create, access, and cache ObjectGrid instances. The ObjectGridManagerFactory class is a static helper class to access the ObjectGridManager interface, a singleton. The ObjectGridManager interface includes several convenience methods to create instances of an ObjectGrid object. The ObjectGridManager interface also facilitates creation and caching of ObjectGrid instances that can be accessed by several users.
- Data access with indexes (Index API)
Using indexing as an alternative to key access for data can be more efficient.
- Access data in WebSphere eXtreme Scale
After an application has a reference to an ObjectGrid instance or a client connection to a remote grid, you can access and interact with data in the WebSphere eXtreme Scale configuration. With the ObjectGridManager API, use one of the createObjectGrid methods to create a local instance, or the getObjectGrid method for a client instance with a distributed grid.
- Use Sessions to access data in the grid
Applications can begin and end transactions through the Session interface. The Session interface also provides access to the application-based ObjectMap and JavaMap interfaces.
- Cache objects with no relationships involved (ObjectMap API)
ObjectMaps are like Java Maps that allow data to be stored as key-value pairs. ObjectMaps provide a simple and intuitive approach for the application to store data. An ObjectMap is ideal for caching objects that have no relationships involved. If object relationships are involved, then you should use the EntityManager API.
- Cache objects and their relationships (EntityManager API)
Most cache products use map-based APIs to store data as key-value pairs. The ObjectMap API and the dynamic cache in WAS, among others, use this approach. However, map-based APIs have limitations. The EntityManager API simplifies the interaction with the eXtreme Scale cache by providing an easy way to declare and interact with a complex graph of related objects.
- Retrive entities and objects (Query API)
WebSphere eXtreme Scale provides a flexible query engine for retrieving entities using the EntityManager API and Java objects using the ObjectQuery API.
- Program for transactions
Applications that require transactions introduce such considerations as handling locks, handling collisions, and transaction isolation.
- Configure clients with WebSphere eXtreme Scale
You can configure a WebSphere eXtreme Scale client based on the requirements such as the need to override settings.
Related concepts
Program with system APIs and plug-ins
Program for administrative tasks
Performance considerations for application developers
Related tasks
Access data with the REST data service
Program for Spring integration
Related reference
Related information