Program guide > Access data with client applications



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.

To connect to a distributed data grid, have configured your server-side environment with a catalog service and container servers.

For more information about finding the listener port for each catalog service, refer to Plan for network ports.Read more about finding the listener port for each catalog service in the Administration Guide.

The getObjectGrid(ClientClusterContext ccc, String objectGridName) method connects to the specified catalog service domain and returns a client ObjectGrid instance corresponding to a server-side ObjectGrid instance.

The following code allows you to connect to a stand-alone distributed data grid using explicit catalog service end points:

// Create an ObjectGridManager instance.

                ObjectGridManager ogm = ObjectGridManagerFactory.getObjectGridManager();

                // Obtain a ClientClusterContext by connecting to a catalog 
                // server based distributed ObjectGrid.  You have to provide
                // a connection end point for the catalog server in the format
                // of hostName:endPointPort.  The hostName is the machine
                // where the catalog server resides, and the endPointPort is
                // the catalog server's listening port, whose default is 2809.
                // Catalog server end-points for a given domain must be in
                // the format of a comma-delimited list.

        String catalogServiceEndpoints = "host1:2809,host2:2809";
        ClientClusterContext ccc = ogm.connect(catalogServiceEndpoints, null, null);

                // Obtain a distributed ObjectGrid using ObjectGridManager and providing
                // the ClientClusterContext.

                ObjectGrid og = ogm.getObjectGrid(ccc, "objectdata gridName");

To connect to a catalog service domain from a client application hosted in WAS, where the catalog service domain has been configured using the administrative console or admin task, the catalog service endpoints can be retrieved using the embedded server API:

                ...

                // Retrieve the catalog service endpoints from the ServerPropeties
                // singleton, which is configured in the WebSphere administration
                // console or admin task.

                String catalogServiceEndpoints = ServerFactory.getServerProperties()
                        .getCatalogServiceBootstrap();
                ClientClusterContext ccc = ogm.connect(catalogServiceEndpoints,
                        null, null);

                ...

If the catalog service domain in WAS is hosted by the deployment manager, clients outside of the cell, including Java™ Platform, Standard Edition clients, must connect to the catalog service using the deployment manager host name and the IIOP bootstrap port. When the catalog service runs in WebSphere Application Server cells while the clients run outside of the cells, look to the eXtreme Scale domain configuration pages in the WebSphere Application Server administrative console for the information needed to point a client to the catalog service.


Parent topic:

Access data with client applications


Related concepts

ObjectGrid interface

BackMap interface

Interacting with an ObjectGrid using ObjectGridManager

Data access with indexes (Index API)

Access data in WebSphere eXtreme Scale

Use Sessions to access data in the grid

Cache objects with no relationships involved (ObjectMap API)

Cache objects and their relationships (EntityManager API)

Retrive entities and objects (Query API)

Configure clients with WebSphere eXtreme Scale

Java object caching concepts

Maps


Related tasks

Program for transactions

Configure grids

ObjectQuery tutorial

Configure entities


+

Search Tips   |   Advanced Search