문제

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

도움이 되었습니까?

해결책

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.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top