QueueMsgAPI is a new way to interface with GuardPoint Pro software.
It allows third party software to send commands to GuardPoint Pro. By design, it works asynchronously.
It is available from GuardPoint Pro version 2.3 release (Precisely from 2.2.533 on 7/10/2011)
In GuardPointPro.ini you need to set 2 new options
UseDBforacAPI = 1
CheckacAPIEachSec = 5
- UseDBforacAPI = 1/0 to tell GuardPointPro to look in the database for API requests or not
- CheckacAPIEachSec defines the number of seconds between two verification of the database
For testing, just put 1 second.
On real site adjust it to few seconds according to the site size.
The way it works:
The GuardPoint Pro database (Access or SQL server) contains a new table QueueMSGAPI with the followings columns:
When third party software introduce a new command, they must set Status=0, Result=0
Each timer interval, we look for new request (Status=0)
As we start treating the request, we update its Status to 1
When we finish treating the request, we update its Status to 2, and its result (1 if OK, 2 if Errors).
- We only take the Top X records of the table, where X is defined in the ini file as QueueMSGTOP (80 by default).
- If we found that we have lots of request in the database, we minimize the interval to the QueueMsgLoadInterval (that should be define as less that CheckacAPIEachSec).
- If for some reasons the processing of the request is longer than the QueueMSGMaxTimeProcessing option defined in the ini file (by default 1 second, 1-10 sec), we do not continue treating the next requests, and we will treat them at the next timer tick.
- Each night at Midnight, we clean up the table from the request that were executed.
Delete from QueueMSGAPI Where [Status] = 2
- This development is compatible with a secondary GuardPointPro server defined as an Hot backup Redundancy server. The ServerName should always be the main server name.
- ImportOneCardHolderXML has a precise answer if it succeed to create the cardholder, the badge, or precise fail reason like MandatoryFieldMissing, AuthorisationExceeded. This information is not return to the Database API (maybe in Comment column later).
Code Sample in C#
We give a Sample project in C# (2008) using .NetFramework 2.0
It requires an OLEDB Connection String.
It gives some example of 4 XML API syntax (4 bottom buttons).
For the sample:
- Introduce the request in the Database
- Look to get its ID
- Then run a timer to inform about the Status.
- When Status finish (=2) Stop the timer.