Skip to main content
Older versions of Internet Explorer will not support certain site features. Chrome, Safari, Firefox, and Edge will provide the best experience.

Using the Queue Monitoring Tool

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:

  1. Download the Queue Monitoring Tool from
  2. Build QueueMonitoringService.sln in Visual Studio 2013.
  3. Copy the Debug directory to the client machine and remember its location.
  4. Install the tool by running the following command with administrative rights:

    C:\Windows\Microsoft.NET\Framework\v4.0.30319>installutil.exe "C:\Users\Administrator\Desktop\QueueMonitoring\Debug\QueueMonitoringService.exe"


  5. 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:

  1. In a text editor, open the QueueMonitoringService.exe.config file from the Debug folder.
  2. 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.
  3. Ensure that you can access the Config service URL in a web browser.
  4. Find the connectionStrings section and change the connectionString parameter 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.
  5. Find the appSettings section in the config file.
  6. If the Care Connect Suite has been installed on separate Platform and Mobile servers, do the following:
    1. Set the IsPlatformInstallation parameter to True on the Platform server, and False on the Mobile server.
    2. On the Mobile server, change the value of the PlatformSmartSuiteServiceUrl parameter to point to the Platform server.
    3. On the Platform server, open port 8000 on the server's Windows Firewall.
  7. 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.

    1. 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.
    2. MessageMaxAgeMillis is the maximum time, in milliseconds, between a message's Accepted and Enroute timestamps, after which the tool will consider the message delayed.
    3. MessageCountThreshold is the number of delayed messages which will trigger a restart of the Spok Mobile services.
    4. 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.
    5. 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.
    6. 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).
    7. 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.
  8. 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 TrueWhen 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:

  1. Make a backup copy of the QueueMonitoringService.exe.config file.
  2. In a web browser, navigate to
  3. Download the file queueMonitoringTool_ConnectionString_Encrypt.bat
  4. Navigate to your downloads directory and run the BAT file that you downloaded.
  5. 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.
  6. After the batch file has completed, open the QueueMonitoringService.exe.config file and confirm that the connectionString section has been encrypted.
  7. Restart the QueueMonitoringService service.
  8. 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:

  1. Edit the batch file and change the -pef parameter to -pdf
  2. Save the batch file.
  3. 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:

  1. Run the following command with administrative rights:
    > C:\Windows\Microsoft.NET\Framework\v4.0.30319> installutil /u .exe
  2. The console should not report any errors or exceptions.
  3. Confirm that the SpokQueueMonitoringService is Disabled in the Services list.
  4. 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:

  1. Navigate to QueueMonitoringService.exe.
  2. Right-click on it and select Properties.
  3. 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:

  1. Navigate to the log4net section in the QueueMonitoringService.exe.config file.
  2. Change the level value parameter from INFO to DEBUG.
  3. Save the configuration file and restart the QueueMonitoringService to put your changes into effect.