FORTRAN Reference Manual

Interprocess Communication
FORTRAN Reference Manual528615-001
14-11
Message Queuing
Your server process returns a Guardian file-system error code in rep-exp, or zero
if no error occurred. The value you store for rep-exp is the value returned to the
requester if it calls the FILEINFO or FILE_GETINFO_ system procedure.
Message Queuing
The preceding examples of the uses of $RECEIVE show server processes that
respond to each request as it is received. An advanced method of interprocess
communication involves message queuing. Figure 14-5 illustrates a server that can
accumulate requests and respond to them in a sequence of its own choosing, which
may or may not be the same as that in which they were received.
In the following example, the server distributes data records from a file to different
requesters. Each requester states in its request, via the PROMPT specifier of a READ
statement, the keys of the records in which it is interested. The server can
accommodate up to four requesters; each requester can ask for up to four distinct
record keys. Both of these limits are fixed by a PARAMETER statement in the server.
Example 14-1 on page 14-12 shows the two requesters. Example 14-2 on page 14-17
shows the server.
Figure 14-5. A Queued Server
VST1408.vsd
Server
Process
Requester
A
Requester
B
Requester
C
Request 1
Reply 3
Request 2
Reply 1
Request 3
Reply 2