Queue Manager Manual

Queue Manager Components and Functions
Queue Management
46517 Tandem Computers Incorporated 1-3
Queue Manager Functions Queue Manager provides four functions for a queue:
Dequeue (remove) an entry from the queue (DEQ)
Enqueue (insert) an entry on the queue (ENQ)
Read an entry on the queue (READQ)
Wait for an entry on the queue (WAITQ)
Note DEQ, ENQ, and READQ requests are sent to an Entry Manager. WAITQ requests are sent to the
Wait Manager.
Queue Manager functions are supported through a message interface suitable for use
in SCREEN COBOL program units.
Dequeue (DEQ) Function A dequeue function is handled by a DEQ request that must be initiated by the
requester process during transaction mode. The DEQ request results in a READLOCK
followed by a WRITEUPDATE to delete the entry from the queue.
The dequeue function does not require that an END TRANSACTION be issued
immediately after the DEQ request. The transaction can persist because a lock on a
deleted entry does not block READ requests to other entries with a similar key value.
Thus, for example, if process A issues a DEQ request for entry 1 in the Queue file,
process B can issue a DEQ request for entry 2 before process A has issued an END
TRANSACTION. A transaction should not be allowed to persist indefinitely,
however. An END TRANSACTION should be issued reasonably soon..
Enqueue (ENQ) Function An enqueue function is handled by an ENQ request that, like the DEQ request, must
be initiated by the requester process in transaction mode. An entry is inserted on the
queue in a single WRITE. The new insertion remains locked until an END
TRANSACTION is issued. Because the lock can block other read requests on that
entry, DEQ or READQ requests received from other processes during such a
transaction might be prevented from operating on available queue entries with a
similar key value.
You can avoid lockout by minimizing the amount of application work performed with
the ENQ request in the TMF transaction.
Note An ENQ request should be followed almost immediately by an END TRANSACTION.
If the appropriate flag has been set in the ENQ Unit of Work (UOW), the ENQ request
causes a message to be sent to the Wait Manager for the Queue file. This message
allows the Wait Manager to respond to any applicable WAITQ request.
Read (READQ) Function A read function is handled by a READQ request from a requester process. The
READQ request need not take place within a TMF transaction. The read function
retrieves an entry from the queue but does not delete the entry. Applications can place
an entry on a queue and then access it repeatedly in read-only mode.