Configuring eXtreme Scale REST clients in the Liberty profile

[Version 8.6 and later]As an administrator, you can define multiple client domain endpoint configurations that can be used by client applications and other features, such as the WebSphere® eXtreme Scale REST gateway.

About this task

As a developer, you can write applications without knowing which grid servers that your applications will connect to. For example, you might have separate servers for test and production. An administrator can configure which environment the application references without making any code changes.

Procedure

  1. Define the client domain in the server.xml file. In the following example, test is the default client domain. If the remoteDomain attribute is not set, then the default domain is used.
    <xsClientDomain default="test">
        <endpointConfig> test ; testHost1:2809,testHost2:2809 ; /home/testuser/client_security.props </endpointConfig>
        <endpointConfig> dev; localhost:2809,testHost2:2809 </endpointConfig>   <!-- note that client security props file is optional -->
        <endpointConfig> production; prodHost1:2809,prodHost2:2809,prodHost3:2809 ; /home/testuser/client_security.props </endpointConfig> 
    </xsClientDomain>
    The endpointConfig element is used to specify endpoint data for a data grid. This element has the following syntax:
    endpoint name ; comma-separated list of hostname:port pairs ; path to client security properties file
    The path to the client security properties file is optional. If it is not specified, then the client connects with the assumption that data grid security is disabled.
  2. Configure the REST gateway now that you have set the previous configuration; for example:
    <xsREST remoteDomain="dev" />
  3. Optional: As a developer, you can access the configured client domains; for example:
    CatalogDomainManager catalogDomainManager = objectGridManager.getCatalogDomainManager();
    CatalogDomainInfo catalogDomainInfo = catalogDomainManager.getDomainInfo("dev");
    if (catalogDomainInfo == null) {
    catalogDomainInfo = catalogDomainManager.getDefaultDomainInfo();
    }
    ClientClusterContext ccc = objectGridManager.connect(catalogDomainInfo.getClientCatalogServerEndpoints(),
    catalogDomainInfo.getClientSecurityConfiguration(), null);
    ...