Skip to main content

Gateway Registry in Caché

Gateway Registry in Caché

The Caché based CSP Gateway Registry registers each connected Gateway installation with Caché and provides the infrastructure to allow Caché code to interact with those Gateway installations. Such programmatically controlled interactions may include reading and modifying the Gateway’s run-time configuration and collecting system status and log information. The relevant classes are as follows:

%CSP.Mgr.GatewayRegistry (The Gateway Registry)
%CSP.Mgr.GatewayMgr  (A Connected Gateway)

The following code will list all connected (i.e. active) Gateway installations and write the web server IP address, port and Gateway build number to the console window.

Set reqistry = $system.CSP.GetGatewayRegistry()
Set gateways = reqistry.GetGatewayMgrs()
For no=1:1:gateways.Count() {
     Set gateway = gateways.GetAt(no)
     Write !,no, " : ",
     Write gateway.IPAddress,":",gateway.Port," ",gateway.Version
}

When Caché is first started this list will be empty. As Administrator and User activity increases expect at least two entries to appear: one for the Private Web Server serving the Management Portal and at least one for external web servers supporting applications.

Further documentation will be found associated with the classes listed above. Some code examples follow to illustrate common tasks.

List Default Parameters

Kill defaults
Do gateway.GetDefaultParams(.defaults)
ZWrite defaults

Update Default Parameter(s)

Kill newpars
Set newpars("Server_Response_Timeout")=30
Do gateway.SetDefaultParams(.newpars)

List Servers

Set status = gateway.GetServers(.servers)
For no=1:1:$ListLength(servers) {
     Set server = $List(servers,no)
     Write !,no, " : ",server
}

List Server Parameters

Kill serverpars
Do gateway.GetServerParams("LOCAL",.serverpars)
ZWrite serverpars

Update Server Parameter(s)

Kill newpars
Set newpars("Maximum_Server_Connections")=250
Do gateway.SetServerParams("LOCAL",.newpars)

List Application Paths

Set status = gateway.GetApplicationPaths(.paths)
For no=1:1:$ListLength(paths) {
     Set path = $List(paths,no)
     Write !,no, " : ",path
}

List Application Parameters

Kill pathpars
Do gateway.GetApplicationParams("/csp",.pathpars)
ZWrite pathpars

Update Application Parameter(s)

Kill newpars
Set newpars("GZIP_Compression")="Enabled"

Clear Gateway cache

Do gateway.ClearCache(“*”)

Forcing the Gateway to Reload Its Configuration

There are occasions when the Gateway’s configuration is modified by external agents (i.e. agents other than the Gateway’s own Systems Management Suite).

There are two methods for interactively instructing the Gateway to reload its configuration, and in a way that doesn’t require a complete restart.

Using the Caché-Based Gateway Registry

The following Registry Method is provided:

Set status = %CSP.Mgr.GatewayMgr.ActivateCSPIni()

When successfully called, the Gateway reads its configuration file (CSP.ini) and activates all changes made.

Using Scripts External to Caché

Scripts should add the following line (case-sensitive) to the SYSTEM section of the modified Gateway configuration file (CSP.ini):

[SYSTEM]
RELOAD=1

The Gateway caretaker daemon checks the RELOAD flag approximately every minute and, if correctly set, reloads and reactives its configuration and removes the flag from the file. The following message is written to the Event Log after a successful reload operation:

Gateway Management 
Gateway Configuration Reloaded and Reactivated
FeedbackOpens in a new tab