Implementation of AQ Queue.
More...
Implementation of AQ Queue.
- Restrictions:
- Qore::PO_NO_DATABASE
AQ messages notification with Oracle Client 10gR2 or above
◆ commit()
bool Qore::Oracle::AQQueue::commit |
( |
| ) |
|
Commit the transaction.
Confirm all posted or fetched messages.
◆ constructor() [1/2]
Qore::Oracle::AQQueue::constructor |
( |
string |
queueName, |
|
|
string |
typeName, |
|
|
string |
desc |
|
) |
| |
Construct a queue object for posting/getting messages from a datasource description string.
- Parameters
-
queueName | a mandatory name of the queue in the database |
typeName | a mandatory name of the type for this queue in the DB |
desc | a datasource description string in the format that can be parsed by parse_datasource() |
- Exceptions
-
AQQUEUE-CONSTRUCTOR-ERROR | invalid arguments to constructor |
DBI-OPTION-ERROR | unknown or unsupported option passed to the Oracle driver |
◆ constructor() [2/2]
Qore::Oracle::AQQueue::constructor |
( |
string |
queueName, |
|
|
string |
typeName, |
|
|
hash |
opts |
|
) |
| |
Construct a queue object for posting/getting messages.
- Parameters
-
queueName | a mandatory name of the queue in the database |
typeName | a mandatory name of the type for this queue in the DB |
opts | a hash giving parameters for the new dedicated connection to the Oracle database server with the following possible keys (the "type" key is optional, but if present, must be "oracle" ):
type: (*string) The name of the database driver to use; this key is optional, but if present must be "oracle" or an exception will be raised
user: (string) The user name for the new connection
pass: (string) The password for the new connection
db: (string) The database name for the new connection
charset: (*string) The Oracle-specific name of the character encoding to use for the new connection. If no value is passed for this parameter, then the Oracle character encoding corresponding to the default character encoding for the Qore process will be used instead.
host: (*string) The host name for the new connection
port: (softint) The port number for the new connection. If this key is present and is 0 then an exception will be raised.
options: (*hash) Any options for the new connection
|
- Exceptions
-
AQQUEUE-CONSTRUCTOR-ERROR | invalid arguments to constructor |
DBI-OPTION-ERROR | unknown or unsupported option passed to the Oracle driver |
◆ copy()
Qore::Oracle::AQQueue::copy |
( |
| ) |
|
Copying objects of this class is not supported, an exception will be thrown.
- Exceptions
-
AQQUEUE-COPY-ERROR | copying AQQueue objects is not yet supported |
◆ getMessage()
*AQMessage Qore::Oracle::AQQueue::getMessage |
( |
softint |
timeout = 0 | ) |
|
Get message from queue.
- Parameters
-
timeout | the timeout in seconds; 0 = no timeout |
- Return values
-
AQMessage | or NOTHING if no message was available in the timeout period |
◆ onAsyncMessage()
nothing Qore::Oracle::AQQueue::onAsyncMessage |
( |
| ) |
|
Automatically called when a new message is received on the queue when there is an active subscription.
A method which is called when there is a new message in the queue.
The default implementation throws an exception; this method must be overridden in subclasses to receive messages; use the AQQueue::getMessage() method to receive the message
- Exceptions
-
◆ onSubscriptionLost()
nothing Qore::Oracle::AQQueue::onSubscriptionLost |
( |
| ) |
|
Automatically called when the connection is externally disconnected.
A method which is called when there is a subscription but the periodical check for a live connection fails.
The default implementation throws an exception; this method must be overridden in subclasses to receive messages; use the AQQueue::startSubscription() method to restore the subscription for example
- Exceptions
-
◆ post() [1/2]
nothing Qore::Oracle::AQQueue::post |
( |
AQMessage |
msg | ) |
|
Post the AQMessage into the queue.
- Parameters
-
◆ post() [2/2]
nothing Qore::Oracle::AQQueue::post |
( |
hash |
msg | ) |
|
Post the plain Oracle object hash into the queue.
- Parameters
-
msg | a qore hash (Oracle object) |
The hash/object will use default message properties. Use post() with an AQMessage instance if you need to modify the message defaults.
◆ rollback()
bool Qore::Oracle::AQQueue::rollback |
( |
| ) |
|
Rollback the transaction.
Rollback all posted or fetched messages.
◆ startSubscription()
nothing Qore::Oracle::AQQueue::startSubscription |
( |
int |
port = 0 , |
|
|
int |
timeout = 0 |
|
) |
| |
Subscribe for asynchronous messages notifications.
- Parameters
-
port | an optional non-negative port number (0 = use the default port) |
timeout | an optional timeout value in seconds; any positive value in seconds is valid. The value 0 is accepted and means that it does not wait for messages and returns immediately if no messages are available. The value -1 is accepted and means it waits for ever (until a message is available in the queue) |
- Exceptions
-
AQQUEUE-ERROR | port or timeout value invalid; subscription already active for this object |
◆ stopSubscription()
nothing Qore::Oracle::AQQueue::stopSubscription |
( |
| ) |
|
Unsubscribe for asynchronous messages notifications.
If no subscription is active, no action is taken
- Exceptions
-
AQQUEUE-ERROR | oracle error stopping the subscription |
The documentation for this class was generated from the following file:
- /Users/david/src/qore/git/module-oracle/src/QC_AQQueue.dox.h