SQL/MX Queuing and Publish/Subscribe Services
Major Queuing Features
HP NonStop SQL/MX Queuing and Publish/Subscribe Services—523734-002
2-3
Stream Timeout Attribute
For more information about concurrency and defaults, see the SQL/MX Reference
Manual.
Stream Timeout Attribute
Many of the examples in this manual are presented as statements you can execute by
using MXCI (the SQL/MX conversational interface). Within MXCI, you can control the
time of the wait state for stream access by setting the session attribute
STREAM_TIMEOUT to a low value:
CONTROL QUERY DEFAULT stream_timeout '300';
The STREAM_TIMEOUT value is set to 300 in hundredths of seconds, which is
equivalent to 3 seconds.
In this stream access example, first set the value of STREAM_TIMEOUT, and then
select data from a stream:
CONTROL QUERY DEFAULT stream_timeout '300';
SELECT * FROM STREAM(quotes);
SYMBOL PRICE
------ -----------
CPQ 26
*** ERROR[8006] The stream timed out,
but the cursor is still open.
When the stream times out, control is returned to the application. If the application is
MXCI, the user will not be able to use the cursor, even though it is still opened. This is
because MXCI does not allow the user to control (open, fetch, and close) cursors
directly. However, a user-written application can use the cursor to fetch again.
For an example of using stream access for the cursor specification in an embedded
SQL statement, see Stream Access on page 3-2.
If you do not set the STREAM_TIMEOUT, the default value is -1.
Embedded DELETE
Embedded DELETE statements allow applications to read and delete rows with a
single operation. Dequeue operations are implemented by using an embedded
DELETE together with stream access.
In Scenario 2. The Invoices Queue (page B-5), the invoices table is defined as:
CREATE TABLE pubs.invoices
(contractnbr INT, amount INT, priority INT);