Damien
Damien

Reputation: 4121

JMS and Oracle AQ

Would anyone be able to point me to some sample java code that shows me to how to listen on an Oracle AQ Queue?

Thanks Damien

Upvotes: 1

Views: 2249

Answers (1)

JOTN
JOTN

Reputation: 6317

Here's the basics. The conn variable contains a regular JDBC Connection class already connected to the DB.

QueueConnection queueConnection = AQjmsQueueConnectionFactory. 
        createQueueConnection(conn); 
QueueSession queueSession = queueConnection. 
        createQueueSession(true, Session.SESSION_TRANSACTED); 
Queue queue=queueSession.createQueue("my_oracle_queue"); 
QueueReceiver receiver= queueSession.createReceiver(queue); 
queueConnection.start(); 
Message message=receiver.receive(); 

The oracle specific classes like AQjmsQueueConnectionFactory are in the package oracle.jms.

Upvotes: 2

Related Questions