09.12.2012 Views

Advanced Queuing - Oracle

Advanced Queuing - Oracle

Advanced Queuing - Oracle

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

Customizing the AQ Servlet<br />

setStyleSheet("text/xsl",<br />

"http://sun-248:8000/stylesheets/bookOrder.xsl");<br />

}<br />

catch (Exception ex)<br />

{<br />

System.out.println("Exception in init: " + ex);<br />

}<br />

}<br />

Callbacks Before and After AQ Operations<br />

Using the AQ servlet, you can register callbacks that will be invoked before and<br />

after AQ operations are performed. This allows users to perform AQ and non-AQ<br />

operations in the same transaction.<br />

To receive callbacks, users register an object that implements the<br />

oracle.AQ.xml.AQxmlCallback interface. The AQxmlCallback interface has<br />

the following methods:<br />

public interface AQxmlCallback<br />

{<br />

/** Callback invoked before any AQ operations are performed by the servlet */<br />

public void beforeAQOperation(HttpServletRequest request, HttpServletResponse<br />

response,<br />

AQxmlCallbackContext ctx);<br />

/** Callback invoked after any AQ operations are performed by the servlet */<br />

public void afterAQOperation(HttpServletRequest request, HttpServletResponse<br />

response,<br />

AQxmlCallbackContext ctx);<br />

}<br />

The callbacks are passed in the HTTP request and response streams and an<br />

AQxmlCallbackContext object. The object has the following methods:<br />

The java.sql.Connection getDBConnection() method gives a handle<br />

<br />

to the database connection that is used by the servlet for performing AQ<br />

operations. Users can perform other SQL operations in the callback functions<br />

using this connection object.<br />

Note that you cannot call close(), commit() or rollback() methods<br />

<br />

on this connection object.<br />

org.w3c.org.Document parseRequestStream() gives a DOM document<br />

<br />

representing the parsed request stream.<br />

17-68 <strong>Oracle</strong>9i Application Developer’s Guide - <strong>Advanced</strong> <strong>Queuing</strong>

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

Saved successfully!

Ooh no, something went wrong!