Summary: This section presents the design and use of the HA Server Application Block, which deals with the Genesys HA proxy to handle and recover cached agent sessions.
The HA Server Application Block shows how to integrate High Availability (HA) in your agent applications through the Genesys HA proxy, which lets you write multicast servers. To manage cached sessions through XML files, this HA proxy is based on Ehcache.
Note: The HA proxy is available in the <Install Location>/thirdparty
directory.
The HA Server Application Block shows how you should implement the HaSessionRecover
interface and how
to integrate the HaCachedSessionService
class to your agent servers. In addition to these best coding pratices, this application block is runnable and demonstrates the mechanism of both session transfer and recover.
Figure 6.1. Class Diagram of the HA Server Application Block
Table 6.1 describes each of the components in Figure 6.1.
Table 6.1: HA Server Application Block Component Description
Class Name |
Description |
AgentService |
Implements the |
HaServer |
Implements a clustered server which emulates a set of agents to test HA. You can start several servers, perform agent actions, and "crash" one of them to see sessions recovering. |
AgentListenerAdapter |
Monitors agent events and traces them in a |
The HA Server Application Block can be used independently from the other
Agent Interaction Application Blocks. Its design makes it easy to compile and run.
In terms of coding practice, you can reuse the AgentService
class as is to manage agent actions, caching, and develop additional services based on this model.
The HaServer
class is designed as a runnable instance for demonstration. At startup, the server gets agent instances, logs them in, and sets their status to ready.
Then, you can emulate calls and further agent actions through the console.
Before you run any instance of HaServer
, make sure that you have defined in the Configuration Layer the agent server applications and one set of agents per server application (<prefix>_10<0..n>
).
Then, edit the following files in the <installation location>/Agent/quickstart/haserver
directory:
ehcache.xml
(ehcache settings)server.properties
(configuration and agent settings)haserver.bat
.
To test HA, run several processes simultaneously, and initialize each of them with different sets of agents.
For instance, if your server1
instance runs with agent_1000.. agent_1009
, and if the server2
instance runs with agent_1010.. agent_1019
, you can test the following script:
server1
window, enter:call 1000 1001
agent_1000
and agent_1001
events in the server1
window.server2
window, enter:answ 1001
agent_1001
events are both in the server1
and server2
windows.
The server2
instance received a request about the agent1
session (opened in server1
). To get the agent1
session and manage the request, it triggered a recover operation.
server2
window, a few seconds later, enter:
rel 1001
agent_1000
events in the server1
window, and agent_1001
events in the server2
window.
Note: This sample uses the agentId
as sessionId
to simplify the implementation.