Oracle9i Application Developer's Guide - Advanced Queuing Release 2 (9.2) Part Number A96587-01 |
|
In this chapter we describe the operational interface to Oracle Advanced Queuing in terms of use cases. That is, we discuss each operation (such as "Creating a Queue Sender") as a use case by that name. The table listing all the use cases is provided at the head of the chapter (see "Use Case Model: Operational Interface -- Basic Operations" on page 14-2).
A summary figure, "Use Case Diagram: Operational Interface -- Basic Operations", locates all the use cases in a single drawing. If you are using the HTML version of this document, you can use this figure to navigate to the use case that interests you by clicking on the relevant use case title.
Each use case is laid out as follows:
See Also:
|
Create a queue connection with username/password.
Not applicable.
Java (JDBC): Oracle9i Supplied Java Packages Reference oracle.jms, AQjmsQueueConnectionFactory.createQueueConnection
QueueConnectionFactory qc_fact = AQjmsFactory.getQueueConnectionFactory("sun123", "oratest", 5521, "thin"); /* Create a queue connection using a username/password */ QueueConnection qc_conn = qc_fact.createQueueConnection("jmsuser", "jmsuser");
See Also:
|
Create a queue connection with an open JDBC connection.
This is a static method.
Java (JDBC): Oracle9i Supplied Java Packages Reference oracle.jms, AQjmsQueueConnectionFactory.createQueueConnection
This method may be used if the user wants to use an existing JDBC connection (say from a connection pool) for JMS operations. In this case JMS will not open a new connection, but instead use the supplied JDBC connection to create the JMS QueueConnection object.
Connection db_conn; /* previously opened JDBC connection */ QueueConnection qc_conn = AQjmsQueueConnectionFactory.createQueueConnection(db_ conn);
This method is the only way to create a JMS QueueConnection when using JMS from java stored procedures inside the database (JDBC Server driver)
OracleDriver ora = new OracleDriver(); QueueConnection qc_conn = AQjmsQueueConnectionFactory.createQueueConnection(ora.defaultConnection());
See Also:
|
Create a queue connection with default connection factory parameters.
The QueueConnectionFactory properties must contain a default username and password: otherwise, this method will throw a JMSException.
Java (JDBC): Oracle9i Supplied Java Packages Reference oracle.jms, AQjmsQueueConnectionFactory.createQueueConnection
See Also:
|
Create a queue connection with an open OracleOCIConnectionPool.
This is a static method.
Java (JDBC): Oracle9i Supplied Java Packages Reference oracle.jms, AQjmsQueueConnectionFactory.createQueueConnection
This method may be used if the user wants to use an existing OracleOCIConnectionPool
instance for JMS operations. In this case JMS will not open an new OracleOCIConnectionPool
instance, but instead use the supplied OracleOCIConnectionPool
instance to create the JMS QueueConnection object.
OracleOCIConnectionPool cpool; /* previously created OracleOCIConnectionPool */ QueueConnection qc_conn = AQjmsQueueConnectionFactory.createQueueConnection(cpool);
See Also:
|
Create a queue session.
Transacted and nontransacted sessions are supported.
Java (JDBC): Oracle9i Supplied Java Packages Reference oracle.jms, AQjmsConnection.createQueueSession
For a transacted session:
QueueConnection qc_conn; QueueSession q_sess = qc_conn.createQueueSession(true, 0);
See Also:
|
Create a queue sender.
If a sender is created without a default Queue, then the destination Queue will have to be specified on every send operation.
Java (JDBC): Oracle9i Supplied Java Packages Reference oracle.jms, AQjmsSession.createSender
See Also:
|
Send a message using a queue sender with default send options.
If the QueueSender has been created with a default queue, then the queue parameter may not necessarily be supplied in the send call. If a queue is specified in the send operation, then this value will override the default queue of the QueueSender.
If the QueueSender has been created without a default queue, then the queue parameter must be specified in every send call.
This send operation uses default values for message priority (1) and timeToLive (infinite).
Java (JDBC): Oracle9i Supplied Java Packages Reference oracle.jms, AQjmsQueueSender.send
/* Create a sender to send messages to any queue */ QueueSession jms_sess; QueueSender sender1; TextMessage message; sender1 = jms_sess.createSender(null); sender1.send(queue, message);
/* Create a sender to send messages to a specific queue */ QueueSession jms_sess; QueueSender sender2; Queue billed_orders_que; TextMessage message; sender2 = jms_sess.createSender(billed_orders_que); sender2.send(queue, message);
See Also:
|
Send messages using a queue sender by specifying send options.
If the QueueSender has been created with a default queue, then the queue parameter may not necessarily be supplied in the send call. If a queue is specified in the send operation, then this value will override the default queue of the QueueSender.
If the QueueSender has been created without a default queue, then the queue parameter must be specified in every send call.
Java (JDBC): Oracle9i Supplied Java Packages Reference oracle.jms, AQjmsQueueSender.send
/* Create a sender to send messages to any queue */ /* Send a message to new_orders_que with priority 2 and timetoLive 100000 milliseconds */ QueueSession jms_sess; QueueSender sender1; TextMessage mesg; Queue new_orders_que sender1 = jms_sess.createSender(null); sender1.send(new_orders_que, mesg, DeliveryMode.PERSISTENT, 2, 100000);
/* Create a sender to send messages to a specific queue */ /* Send a message with priority 1 and timetoLive 400000 milliseconds */ QueueSession jms_sess; QueueSender sender2; Queue billed_orders_que; TextMessage mesg; sender2 = jms_sess.createSender(billed_orders_que); sender2.send(mesg, DeliveryMode.PERSISTENT, 1, 400000);
See Also:
|
Create a queue browser for queues with text, stream, objects, bytes or map messages.
To retrieve messages that match certain criteria, the selector for the QueueBrowser can be any expression that has a combination of one or more of the following:
JMSPriority < 3 AND JMSCorrelationID = 'Fiction'
color IN ('RED', BLUE', 'GREEN') AND price < 30000
All message IDs must be prefixed with "ID:"
Use methods in java.util.Enumeration to go through list of messages.
Java (JDBC): Oracle9i Supplied Java Packages Reference oracle.jms, AQjmsSession.createBrowser
/* Create a browser without a selector */ QueueSession jms_session; QueueBrowser browser; Queue queue; browser = jms_session.createBrowser(queue);
/* Create a browser for queues with a specified selector */ QueueSession jms_session; QueueBrowser browser; Queue queue; /* create a Browser to look at messages with correlationID = RUSH */ browser = jms_session.createBrowser(queue, "JMSCorrelationID = 'RUSH'");
See Also:
|
Create a queue browser for queues with text, stream, objects, bytes or map messages, locking messages while browsing.
If locked parameter is specified as true, messages are locked as they are browsed. Hence these messages cannot be removed by other consumers until the browsing session ends the transaction
Java (JDBC): Oracle9i Supplied Java Packages Reference oracle.jms, AQjmsSession.createBrowser
/* Create a browser without a selector */ QueueSession jms_session; QueueBrowser browser; Queue queue; browser = jms_session.createBrowser(queue, null, true);
/* Create a browser for queues with a specified selector */ QueueSession jms_session; QueueBrowser browser; Queue queue; /* create a Browser to look at messages with correlationID = RUSH in lock mode */ browser = jms_session.createBrowser(queue, "JMSCorrelationID = 'RUSH'", true);
See Also:
|
Create a queue browser for queues of Oracle object type (ADT) messages.
For queues containing AdtMessages
the selector for QueueBrowser can be a SQL expression on the message payload contents or messageID or priority or correlationID.
msgid = '23434556566767676'
Note: in this case message IDs must NOT be prefixed with 'ID:'
priority < 3 AND corrid = 'Fiction'
tab.user_data.color = 'GREEN' AND tab.user_data.price < 30000
Java (JDBC): Oracle9i Supplied Java Packages Reference oracle.jms, AQjmsSession.createBrowser
The CustomDatum factory for a particular java class that maps to the SQL ADT payload can be obtained using the getFactory
static method.
Assume the Queue - test_queue has payload of type SCOTT.EMPLOYEE
and the java class that is generated by Jpublisher for this ADT is called Employee. The Employee class implements the CustomDatum interface. The CustomDatumFactory for this class can be obtained by using the Employee.getFactory() method.
/* Create a browser for a Queue with Adt messages of type EMPLOYEE*/ QueueSession jms_session QueueBrowser browser; Queue test_queue; browser = ((AQjmsSession)jms_session).createBrowser(test_queue, "corrid='EXPRESS'", Employee.getFactory());
See Also:
|
Create a queue browser for queues of Oracle object type (ADT) messages, locking messages while browsing.
Not applicable.
Java (JDBC): Oracle9i Supplied Java Packages Reference oracle.jms, AQjmsSession.createBrowser
/* Create a browser for a Queue with Adt messages of type EMPLOYEE* in lock mode/ QueueSession jms_session QueueBrowser browser; Queue test_queue; browser = ((AQjmsSession)jms_session).createBrowser(test_queue, null, Employee.getFactory(), true);
See Also:
|
Browse messages using a queue browser.
Use methods in java.util.Enumeration to go through the list of messages.
Java (JDBC): Oracle9i Supplied Java Packages Reference oracle.jms, AQjmsQueueBrowser
/* Create a browser for queues with a specified selector */ public void browse_rush_orders(QueueSession jms_session) { QueueBrowser browser; Queue queue; ObjectMessage obj_message BolOrder new_order; Enumeration messages; /* get a handle to the new_orders queue */ queue = ((AQjmsSession) jms_session).getQueue("OE", "OE_neworders_que"); /* create a Browser to look at RUSH orders */ browser = jms_session.createBrowser(queue, "JMSCorrelationID = 'RUSH'"); /* Browse through the messages */ for (messages = browser.elements() ; message.hasMoreElements() ;) { obj_message = (ObjectMessage)message.nextElement(); } }
See Also:
|
Create a queue receiver for queues of standard JMS type messages.
The selector for the QueueReceiver can be any expression that has a combination of one or more of the following:
JMSPriority < 3 AND JMSCorrelationID = 'Fiction'
color IN ('RED', BLUE', 'GREEN') AND price < 30000
All message IDs must be prefixed with "ID:"
Java (JDBC): Oracle9i Supplied Java Packages Reference oracle.jms, AQjmsSession.createReceiver
/* Create a receiver without a selector */ QueueSession jms_session QueueReceiver receiver; Queue queue; receiver = jms_session.createReceiver(queue);
/* Create a receiver for queues with a specified selector */ QueueSession jms_session; QueueReceiver receiver; Queue queue; /* create a Receiver to receive messages with correlationID starting with EXP */ browser = jms_session.createReceiver(queue, "JMSCorrelationID LIKE 'EXP%'");
See Also:
|
Create a queue receiver for queues of Oracle object type (ADT) messages.
The CustomDatum factory for a particular java class that maps to the SQL ADT payload can be obtained using the getFactory
static method.
For queues containing AdtMessages
the selector for QueueReceiver can be a SQL expression on the message payload contents or messageID or priority or correlationID.
msgid = '23434556566767676'
Note: in this case message IDs must NOT be prefixed with 'ID:'
priority < 3 AND corrid = 'Fiction'
tab.user_data.color = 'GREEN' AND tab.user_data.price < 30000
Java (JDBC): Oracle9i Supplied Java Packages Reference oracle.jms, AQjmsSession.createReceiver
Assume the Queue - test_queue has payload of type SCOTT.EMPLOYEE and the java class that is generated by Jpublisher for this ADT is called Employee. The Employee class implements the CustomDatum interface. The CustomDatumFactory for this class can be obtained by using the Employee.getFactory() method.
/* Create a receiver for a Queue with Adt messages of type EMPLOYEE*/ QueueSession jms_session QueueReceiver receiver; Queue test_queue; browser = ((AQjmsSession)jms_session).createReceiver(test_queue, "JMSCorrelationID = 'MANAGER', Employee.getFactory());
See Also:
|
Create a queue connection with an open OracleOCIConnectionPool.
This is a static method.
Java (JDBC): Oracle9i Supplied Java Packages Reference oracle.jms, AQjmsQueueConnectionFactory.createQueueConnection
This method may be used if the user wants to use an existing OracleOCIConnectionPool
instance for JMS operations. In this case JMS will not open an new OracleOCIConnectionPool
instance, but instead use the supplied OracleOCIConnectionPool
instance to create the JMS QueueConnection object.
OracleOCIConnectionPool cpool; /* previously created OracleOCIConnectionPool */ QueueConnection qc_conn = AQjmsQueueConnectionFactory.createQueueConnection(cpool); Connection db_conn; /* previously opened JDBC connection */ QueueConnection qc_conn = AQjmsQueueConnectionFactory.createQueueConnection(db_ conn);
|
Copyright © 1996, 2002 Oracle Corporation. All Rights Reserved. |
|