[Version 8.6.1 and later]

Configuring the client to use HTTP session failover

If you created a data grid in XSLD that uses the Session template, you must configure the eXtreme Scale client using the elasticCacheClient-1.0 feature.

Before you begin

Create a data grid in XSLD that uses the Session template. As a general example of steps, see Lesson 3: Creating a data grid, but make sure that you select Session from the drop-down list.

About this task

You can configure a web application server so that when the web server receives an HTTP request for session replication, the request is forwarded to one or more servers that run in Liberty. Liberty does not include session replication. However, if you use WebSphere®® eXtreme Scale with Liberty, then you can replicate sessions. Therefore, if a server fails, then application users do not lose session data.

Procedure

  1. Open the server.xml and add the elasticCacheClient-1.0 feature.
    Example
    
    <featureManager>  
          <feature>elasticCacheClient-1.0</feature>     
    </featureManager>
  2. Add the <httpSessionElasticCache/> configuration element and set it to true.
    Example
    
    <httpSessionElasticCache enabled="true"/>
  3. Optional: Configure HTTP session failover for a remote session grid.
    By default, the eXtreme Scale client connects to the local host 2809.
    An example code snippet that shows how to configure for a remote session grid. It is expected that the session grid is available in this host and port.
    
    <httpSessionElasticCache enabled="true" elasticCacheClientRef="client1"/> 
    <elasticCacheClient id="client1">
          <elasticCacheCatalogCluster>
               <server host="host" port="17196"/>
          </elasticCacheCatalogCluster>
    </elasticCacheClient>

Example

See the following example of a server.xml file, which contains the webApp feature that you use when you connect to the data grid remotely.

<server description="HTTP Session Application Sample Remote Grid">
<!--
	This sample program is provided AS IS and may be used, executed, copied and modified
	without royalty payment by customer
	(a) for its own instruction and study,
	(b) in order to develop applications designed to run with an IBM WebSphere product,
	either for customer's own internal use or for redistribution by customer, as part of such an
	application, in customer's own products.
	Licensed Materials - Property of IBM
	5724-X67, 5655-V66 (C) COPYRIGHT International Business Machines Corp. 2012, 2020

-->
	<!-- Enable features -->
	<featureManager>
		<feature>elasticCacheClient-1.0</feature>
	</featureManager>
	<httpEndpoint id="defaultHttpEndpoint"
		host="*"
		httpPort="9080"
		httpsPort="9443" />
	<httpSession idReuse="true" />

	<elasticCacheClient id="client1" elasticCacheCatalogClusterRef="ep1" elasticCacheClientSecurityRef="securitySettings"/>
	<elasticCacheCatalogCluster id="ep1">
			<!-- ************************************************************** -->
			<!-- Specify the list of catalog server endpoint here               -->
			<!-- Each server element should corresponding to one catalog server -->
			<!-- ************************************************************** -->
			<server host="169.46.22.168" port="4809" />
	</elasticCacheCatalogCluster>
	<elasticCacheClientSecurity id="securitySettings"
								enabled="true"
								transportType="TCP/IP"
								credentialGeneratorClass="com.ibm.websphere.objectgrid.security.plugins.builtins.UserPasswordCredentialGenerator"
								credentialGeneratorProps="user passwd"/>
	<httpSessionElasticCache enabled="true" elasticCacheClientRef="client1" gridName="session"/>
    <logging traceSpecification="*=info:session=all=enabled" maxFileSize="200" maxFiles="10" />
</server>