AQSession - Oracle 9i

Methods
createQueueTable

This method creates a new queue table in a particular user’s schema according to the properties specified in the AQQueueTableProperty object passed in.

createQueueTable

Returns

AQQueueTable object

getQueueTable

This method is used to get a handle to an existing queue table.

getQueueTable

Returns

AQQueueTable object

createQueue

This method creates a queue in a queue_table with the specified queue properties. It uses the same schema name that was used to create the queue table.

create the queue table.

Returns

AQQueue object

getQueue

This method can be used to get a handle to an existing queue.

getQueue

Returns

AQQueue object

getDB Connection

public java.sql.Connection getDBConnection()

This method can be used to get the underlying JDBC connection from an AQ session object.This method is available only in the Oracle server implementation of AQSession. Hence the AQSession object must be cast to AQOracleSession before calling this method.
Example

AQSession aq_sess;
Connection db_conn =((AQOracleSession)aq_sess).getDBConnection();

listen

This method can be used to listen to multiple queues for messages.

listen

Returns

Agent with a message available for consumption

Throws

AQException if listen failed due to time-out (ORA-25254) or another error

Setup for oracle.AQ Examples
1. Create an oracle.AQ User

Here an ’aqjava’ user is setup as follows:

2. Set up main class

Next we set up the main class from which we will call subsequent examples and handle exceptions.

3. Create an AQ Session;

Next, an AQ Session is created for the ’aqjava’ user as shown in the AQDriverManager section above:

Example. Create a queue table and a queue

Now, with the ’runTest’ class, called from the above main class, we will create a queue table and queue for the ’aqjava’ user.

2. Get a handle to an existing queue table and queue


All rights reserved © 2018 Wisdom IT Services India Pvt. Ltd DMCA.com Protection Status

Oracle 9i Topics