The Queue Monitoring Tool automatically restarts the Spok Mobile service if messages become too delayed.
The Queue Monitoring tool performs the same function as the Message Duration Tracker feature,which can be configured on the Edit Mobile Configuration page. However, the Queue Monitoring Tool is not part of the Spok Mobile Server solution, and can be used without upgrading the Care Connect Suite. For more information about the server-side Message Duration Tracker, see Changing Spok Mobile Configuration Settings.
Messages will not be lost when the Spok Mobile services restart. If a user sends a message at the exact time that the services restart, the message would fail, but Spok Contact Centers can automatically resend the message so it will not be lost.
The Queue Monitoring Tool is only supported on Spok Mobile 4.4.x and SmartSuite 5.7.
In order to install and run the Queue Monitoring Tool, you must first install the following versions of the .NET Framework:
- .NET Framework 4 Multi-Targeting Pack
- .NET Framework 4.6.2
Installing the Queue Monitoring Tool
If the Care Connect Suite has been installed on separate Platform and Mobile servers, install the Queue Monitoring Tool on both servers.
To install the Queue Monitoring Tool, do the following:
- Download the Queue Monitoring Tool from http://svn.amcomsoft.com/dev/CareConnect.QueueMonitoringTool/trunk/
- Build QueueMonitoringService.sln in Visual Studio 2013.
- Copy the Debug directory to the client machine and remember its location.
Install the tool by running the following command with administrative rights:
After the installation is complete, the SpokQueueMonitoringService will appear in the Services list.
Configuring Queue Monitoring Settings
To configure the Queue Monitoring Tool, do the following:
- In a text editor, open the QueueMonitoringService.exe.config file from the Debug folder.
- In the config file, find the cnfgClient section and change the URL value of the cnfgClient parameter to the URL of the Platform Server's Config service.
- Ensure that you can access the Config service URL in a web browser.
- Find the connectionStrings section and change the
connectionStringparameter so that it points to the mobile server database.TIP: For information about how to encrypt the credentials in the connection String section, see the Securing the Database Credentials section below.
- Find the appSettings section in the config file.
- If the Care Connect Suite has been installed on separate Platform and Mobile servers, do the following:
- Set the IsPlatformInstallation parameter to
Trueon the Platform server, and
Falseon the Mobile server.
- On the Mobile server, change the value of the PlatformSmartSuiteServiceUrl parameter to point to the Platform server.
- On the Platform server, open port 8000 on the server's Windows Firewall.
- Set the IsPlatformInstallation parameter to
- You can configure the following settings in the appSettings section:
Do not change any other parameters in the QueueMonitoringService.exe.config file. The other parameters represent the names of the Care Connect services that will be restarted when the tool triggers a restart.
- ExecutionTimeIntervalMillis determines the interval, in milliseconds, after which the tool will check for delayed messages. This is also the minimum interval between service restarts, if the tool finds too many delayed messages.
- MessageMaxAgeMillis is the maximum time, in milliseconds, between a message's Accepted and Enroute timestamps, after which the tool will consider the message delayed.
- MessageCountThreshold is the number of delayed messages which will trigger a restart of the Spok Mobile services.
- IsQueuedMessageManagerTracked determines whether the tool will track the number of records in the database table which are in the message queue. If this is parameter is set to True, the tool will monitor the QueuedMessageManagerCountThreshold count (see below) and restart the Spok services if the threshold is reached.
- QueuedMessageManagerCountThreshold determines the maximum number of records in the database table which will be allowed to be in the message queue. When this threshold is reached, the Spok services will be restarted.
- IsQueuedServiceRequestsTracked determines whether the tool will track the number of records in the database table which have made service requests to external services. If this parameter is set to True, the tool will monitor the QueuedServiceRequestsCountThreshold parameter (see below).
- QueuedServiceRequestsCountThreshold is the number of delayed service requests made to external services (such as Platform services). These external services requests are stored in Mobile Server’s [AmcomAmcPremiseCore].[dbo].[ServiceRequests] database table.
- After you have made your changes to the config file, start or restart the SpokQueueMonitoringService Windows service to apply your changes.
After the SpokQueueMonitoringService has been started or restarted, you should see a logs directory in the installation folder, with the log file queuemonitoringservice-log.txt inside.
The log file should record the following messages:
- When the QueueMonitoringService starts:
----- Starting QueueMonitoringService -----
- When the QueueMonitoringService stops:
----- Stopping QueueMonitoringService -----
- When a message is delayed more than the threshold set by MessageMaxAgeMillis:
Added one more delayed message with time delay [time]!
- When the MessageCountThreshold has been reached and the tool restarts the Spok Mobile service:
QueueMonitoringService: Restarting Spok Mobile Server services due to the count of delayed messages...
Configuring a Dry Run of the Queue Monitoring Tool
You can perform a dry run of the Queue Monitoring Tool by setting the IsDryRun parameter to
True. When this parameter is set to
True, the Spok Mobile service will not restart when the MessageCountThreshold is reached. Instead, the following message will be logged when the threshold is reached:
Dry Run of QueueMonitoringService: Spok Mobile Server services would have been restarted!
A dry run allows you to experiment with the settings in the QueueMonitoringService.exe.config file, without actually causing the Spok Mobile service to restart. When you are finished configuring the Queue Monitoring Tool in a dry run, set the IsDryRun parameter to False to deactivate the dry run.
Securing the Database Credentials
In the QueueMonitoringService.exe.config file, the connectionString section contains the Mobile database credentials in plain text format. To encrypt these credentials, do the following:
- Make a backup copy of the QueueMonitoringService.exe.config file.
- In a web browser, navigate to http://svn.amcomsoft.com/dev/CareConnect.QueueMonitoringTool/trunk/
- Download the file
- Navigate to your downloads directory and run the BAT file that you downloaded.
- You will be prompted to enter the location of the QueueMonitoringService.exe.config file. Type the full path to the configuration file and press Enter. When prompted, press any key to continue.
- After the batch file has completed, open the QueueMonitoringService.exe.config file and confirm that the connectionString section has been encrypted.
- Restart the QueueMonitoringService service.
- Check the QueueMonitoringService logs for any errors.
The encrypted configuration file can only be used on the machine on which it was encrypted. It will not work properly if you copy it to any other server.
To decrypt the configuration file, do the following:
- Edit the batch file and change the
- Save the batch file.
- Execute the batch file by following steps 2 through 4 above.
Removing the Queue Monitoring Tool
To remove the Queue Monitoring Tool, do the following:
- Run the following command with administrative rights:
> C:\Windows\Microsoft.NET\Framework\v4.0.30319> installutil /u
- The console should not report any errors or exceptions.
- Confirm that the SpokQueueMonitoringService is Disabled in the Services list.
- Restart Services and confirm that SpokQueueMonitoringService has been removed from the Services list.
Installing the Queue Monitoring Tool on a Platform Server
The Queue Monitoring Tool can be installed on the Platform server; in this case, the Platform's web services will be restarted when the tool's conditions are met.
To install the tool on the Platform server, perform the installation on the Platform server and set the IsPlatformInstallation parameter to
True in the QueueMonitoringService.exe.config file.
If you are using a load-balanced configuration, perform the installation steps on all Platform servers.
You may see the following error:
System.IO.FileLoadException: Could not load file or assembly 'file:<path on client environment>QueueMonitoringService.exe' or one of its dependencies. Operation is not supported. (Exception from HRESULT: 0x80131515).
To resolve this, do the following:
- Navigate to QueueMonitoringService.exe.
- Right-click on it and select Properties.
- If you see an Unblock button, click it.
You may also encounter the following errors:
ERROR RestartService could not start the Amc service
This is a normal message if the service startup type is disabled.
System.ServiceProcess.TimeoutException: Time out has expired and the operation has not been completed.
This message may or may not indicate an error. Check the SpokQueueMonitoringService details to determine if the service is functioning as expected.
To view debugging information in queuemonitoringservice-log.txt, do the following:
- Navigate to the
log4netsection in the QueueMonitoringService.exe.config file.
- Change the level value parameter from
- Save the configuration file and restart the QueueMonitoringService to put your changes into effect.