SQL/MX Queuing and Publish/Subscribe Services

Major Queuing Features
HP NonStop SQL/MX Queuing and Publish/Subscribe Services523734-002
2-2
Stream Access
The examples in this section use the scenarios described in Appendix B, Examples.
Note that the examples apply to both SQL/MP and SQL/MX tables, as described in
Support for SQL/MP and SQL/MX Tables on page 1-5.
Stream Access
The stream access mode first causes a regular scan of the table and, after all available
rows have been returned, causes fetch operations to wait (block) instead of returning
the end-of-data condition. The fetch operation resumes when new rows become
available.
In Scenario 1. The Quotes Channel (page B-2), the quotes table is defined as:
CREATE TABLE psdb.pubs.quotes
(symbol CHAR(5), price INT);
An application subscribes to stock quotes by issuing this SELECT statement:
SET NAMETYPE ANSI;
SET SCHEMA psdb.pubs;
SELECT * FROM STREAM(quotes);
This application is in a wait state until rows are inserted into the table.
Another application publishes a stock quote by issuing this INSERT statement:
INSERT INTO quotes VALUES('CPQ', 26);
The first application receives the quote and then continues its wait state:
SYMBOL PRICE
------ -----------
CPQ 26
The stream can last indefinitely, unless it is terminated by an error, a transaction
timeout, or a concurrent DDL or utility operation.
Streams assume parallel access to data; that is, if a table is partitioned and you
attempt to access it as a stream, parallel access to partitions is required. If you try to
access a stream when the ATTEMPT_ASYNCHRONOUS_ACCESS default is set to
OFF, SQL/MX returns an error.
Joins on page 2-15 Allows rows from a stream to be joined to a
table.
Run-Time Limits on Streams on
page 2-16
Describes the list used by the Data Access
Manager (DAM) to monitor for the stream
overflow condition.
Restarting a Subscriber on
page 2-17
Describes conditions that cause a cursor to
close and require subscribers to be restarted.