A registered procedure is a procedure that is defined and installed in a running Open Server application, and extends the functionality of Adaptive Server.
For Client-Library applications, registered procedures provide a means for inter-application communication and synchronization. This is because Client-Library applications connected to an Open Server watches for a registered procedure to execute. When the registered procedure executes, applications watching for it receive a notification that includes the procedure’s name and the arguments it was called with.
For example, suppose that:
stockprice is a real-time Client-Library application monitoring stock prices.
price_change is a registered procedure created in Open Server by stockprice, and that price_change takes as parameters a stock name and a price differential.
sellstock, an application that puts stock up for sale, has requested that it be notified when price_change executes.
When stockprice, the monitoring application, becomes aware that the price of Extravagant Auto Parts stock has risen $1.10, it executes price_change with the parameters “Extravagant Auto Parts” and “+1.10”.
When price_change executes, Open Server sends sellstock a notification containing the name of t he procedure (price_change) and the arguments passed to it (“Extravagant Auto Parts” and “+1.10”). sellstock uses the information contained in the notification to decide whether or not to sell Extravagant Auto Parts stock.
price_change is the means through which the stockprice and sellstock applications communicate.
Registered procedures as a means of communication have the following advantages:
A single call to execute a registered procedure results in many client applications being notified that the procedure has executed. The application executing the procedure does not need to know how many, or which, clients have requested information.
The registered procedure communication mechanism is server-based. Open Server acts as a central repository for connection addresses. Because of this, client applications communicate without having to connect directly to each other. Instead, each client simply connects to the Open Server.
A Client-Library application makes remote procedure calls to Open Server system registered procedures to:
Create a registered procedure in Open Server.
A Client-Library application creates only registered procedures that contain no executable statements. These bodiless procedures are primarily useful for communication and synchronization purposes.
Drop a registered procedure.
List all registered procedures defined in Open Server.
Request to be notified when a particular registered procedure is executed.
List all registered procedure notifications that the client connection is waiting for.
Execute a registered procedure.
For more information about Open Server system registered procedures, see the Open Server Server-Library/C Reference Manual.
An application calls Client-Library routines to:
Install a user-supplied notification callback routine to be called when the application receives notification that a registered procedure has executed
Poll the network (if necessary) to see if any registered procedure notifications are waiting