Use this task to enable optimized local adapters to use
high availability support.
Before you begin
The optimized local resource adapter participates in the WebSphere® Application Server high availability
support, which provides the ability to specify an alternate connection
factory JNDI name in the connection factory pool custom properties.
Important: For the high availability support to function properly,
the resource register name must be specified on the managed connection
using the connection factory Register Name attribute for both the
primary and alternate resource connection factory. Using the setRegisterName()
method prevents the alternate resource from getting control.
To
use the optimized local adapters high availability support, complete
the following steps.
Procedure
- Add the property, alternateResourceJNDIName, to the connection
pool properties for a connection factory. Specify the JNDI name of
the alternate resource connection factory.
For example,
if your primary JNDI is eis/ola and you want to make eis/ola_backup the
alternate, set alternateResourceJNDIName property to eis/ola_backup and
add this property to a connection pool property on the eis/ola connection
factory.
- Ensure that the external address space associated with
the alternate connection factory registration name is available for
the fail over to occur.
The optimized local adapter
resource fail over process is triggered when an application makes
a getconnection() request for a resource that fails because the target
registration is not available. During this process, the alternate
JNDI resource name is used for the getconnection() instead. The number
of failed attempts before the fail over is tried can be configured
by adding another connection pool property, failurethreshold. Setting
a threshold of 1, means that after a single
attempt at getting a connection is failed (with a Resource Exception)
subsequent requests are routed to the alternate connection factory.
A
fail over event triggers a process to send subsequent requests to
the alternate resource with the alternate JNDI name and register name
and initiates a polling process where WebSphere Application Server connection management
sends a request every 10 seconds to determine if the primary resource
is available again. WebSphere Application Server connection
management can also send a message to the WebSphere Application Server servant log, indicating
the fail over to the alternate, and switch back to the primary. You
can use the failureNotificationActionCode property on the connection
pool for the connection factory to select which notification is wanted.
The default value of 1 indicates that messages
are sent to the servant job log. Refer to the topic, Resource routing
for data source and connection factory, for more information.
When
the WOLA resource adapter detects that the primary resource is available
again or that the register name is active, WebSphere Application Server connection management
is notified that future requests for the primary resource JNDI can
be routed back to the primary connection factory. Since there is a
10-second delay between requests to check for the primary, when the
primary registration is active again, there can be as much as 10 seconds
before the switch occurs back to the primary registration.
- Restart the server. After adding the alternateResourceJNDIName
or any other connection pool properties, the server must be restarted
for the properties to take effect.