09.12.2012 Views

Advanced Queuing - Oracle

Advanced Queuing - Oracle

Advanced Queuing - Oracle

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

import javax.servlet.*;<br />

import javax.servlet.http.*;<br />

import oracle.AQ.*;<br />

import oracle.AQ.xml.*;<br />

import java.sql.*;<br />

import oracle.jms.*;<br />

import javax.jms.*;<br />

import java.io.*;<br />

import oracle.jdbc.pool.*;<br />

/* This is an AQ Propagation Servlet. */<br />

public class AQPropServlet extends oracle.AQ.xml.AQxmlServlet<br />

Propagation Features<br />

/* getDBDrv - specify the database to which the servlet will connect */<br />

public AQxmlDataSource createAQDataSource() throws AQxmlException<br />

{<br />

AQxmlDataSource db_drv = null;<br />

db_drv = new AQxmlDataSource("aqadm", "aqadm", "dest-db", "dest-host",<br />

5521);<br />

return db_drv;<br />

}<br />

public void init()<br />

{<br />

try {<br />

AQxmlDataSource axds = this.createAQDataSource();<br />

setAQDataSource(axds) ;<br />

setSessionMaxInactiveTime(180) ;<br />

}<br />

}<br />

} catch (Exception e) {<br />

System.err.println("Error in init : " +e) ;<br />

}<br />

This servlet must connect to the destination database. The servlet must be<br />

deployed on the Web server in the path aqserv/servlet. In <strong>Oracle</strong>9i, the<br />

propagation servlet name and deployment path are fixed; that is, they must be<br />

AQPropServlet and aqserv/servlet, respectively.<br />

Assume that the Web server host and port are webdest.oracle.com and<br />

8081, respectively.<br />

2. Create the database link dba.<br />

A Sample Application Using AQ 8-119

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!