image001 (1)

CCT Open Interfaces SDK

Tutorial 3 A - Registering For Specific Agent Events

1. Introduction. 1

2. Registering For Specific Agent Events. 2

Description of Tutorial 2

Notes about this tutorial 2

Step 1: Updating the local hosts file. 4

Step 2: Import the source code. 6

Step 3: Changes to the Code. 8

Step 4: Running the Sample Program.. 11

Step 5: Looking at some of the TCP packages. 15

 

 

1. Introduction

This tutorial will demonstrate how to subscribe for specific agent events via the Notification Producer Service. We will also use a program to capture some of the TCP packets that are being sent and received by the client and show you how exactly the information is being passed over the wire.

 

 

 

2. Registering For Specific Agent Events

Description of Tutorial

This tutorial describes how to utilise the features provided by the SOA CCT Web Services. It demonstrates how to detect agent log in events and ready state change events. We will also use a tool to capture TCP/IP packets and display what some of the specific XML packages look like.

The main procedures in this tutorial are:

Step1: Updating the local hosts file

Step 2: Import the Source Code

Step 3: Changes to the Code  

Step 4: Running the Sample Program

Step 5: Looking at some of the TCP packages

This tutorial utilises the Agent Terminal Service and the Notification Producer Service to demonstrate this functionality.

Please download the source code here.

Notes about this tutorial

The SOA Web Services must be installed and running on an available server.

The tutorial uses eclipse as the IDE, Java 8 JRE.

Common programming practices such as delegates, events, threading, and exceptions are left to the individual programmer and are not covered in this tutorial.

Exception handling is not shown in the code samples for brevity.

You must determine exactly where or how you want to implement the example code shown in these tutorials in your own application.

To instigate events being received by the consumers, CCT Ref client can be used to login and logout agents as well as going ready/not ready.

This tutorial uses a program called SmartSniff 2.05 to capture TCP/IP packages.

This program uses the source code from Tutorial 2 and as such only the code changes will be shown in the code samples.

 

 

Step 1: Updating the local hosts file

 

1.      Open up the hosts file and map the host name of your server to an IP address

image001 (2)

 

 

 

 

 

Step 2: Import the source code

            To import the project zip file:

1. Open Eclipse IDE

2. Select File > Import > Existing Projects into Workspace

image001 (3)

3.      Select the project zip file

image001 (4)

4.      Press the finish button

 

 

 

 

 

Step 3: Changes to the Code

            [Refer to TestNofication.java in the source of the sample project]

1.      TestNofication.java

·          We are only registering for events using the NotificationProducer service so all references to the Subscribe function on the UserService is commented out.

·          We are also passing the SsoToken we received after we log in to the NotificationProducerSubscribe class

 

 image001 (19)

 

[Refer to NotificationProducerSubscribe.java in the source of the sample project]

2.      NotificationProducerSubscribe.java

A.      We are declaring a new AgentTerminalService.

image001 (20)

B.      We are adding the SsoToken parameter into the constructer.

image001 (21)

image001 (13)

C.      We are passing 2 new variables, the agentTerminalService and the ssotoken into the Consumer2Impl class.

image001 (14)

D.     We are only registering for:

o    TerminalProperty.AGENT_LOGIN_SESSION

o    TerminalProperty.AGENT_LOGIN_SESSION_ENDED

o    TerminalProperty.READY_STATUS

image001 (15)

 

[Refer to ConsumerImpl2.java in the source of the sample project]

3.      ConsumerImpl2.java

A.      We are declaring a new AgentTerminalService and a SooToken and created a new constructer that takes 2 arguments, AgentTerminalService and SsoToken

image001 (16)

C.      We are passing the TerminalPropertyEvent to a new method

image001 (17)

D.     The new method, printTerminalPropertyEventTypeDetails will print out to the console

image001 (18)

 

 

Step 4: Running the Sample Program

a.      Start the SmartSniff program.

Code sample: Here is a Sample of some of the TCP packages obtained

image001 (5)

 

 

b.      Run the Sample Code. The main class to run is Sample.run.TestNotifications. Please make sure to update the variables at the top of the class.

image001 (6)

 

Code sample: Here is a sample of the output of the program

image001 (7)

 

c.       Wait for Agents to log in and update their Ready Status. Any changes will be printed out to the console and recorded by SmartSniff.

 

 

Step 5: Looking at some of the TCP packages

Code sample: AGENT_LOGIN_SESSION

image001 (8)

Code sample: AGENT_LOGIN_SESSION_ENDED

image001 (9)

Code sample: GetLoginIdRequest

image001 (10)

Code sample: GetLoginIdResponse

image001 (11)

Code sample: READY_STATUS

image001 (12)