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.

General Features of <strong>Advanced</strong> <strong>Queuing</strong><br />

/* Grant enqueue privilege on the billed orders queue to Customer Billing<br />

application. The CB application is allowed to put billed orders into this<br />

queue after processing the orders. */<br />

EXECUTE dbms_aqadm.grant_queue_privilege(<br />

'ENQUEUE', 'CBADM_billedorders_que', 'CB', FALSE);<br />

Visual Basic (OO4O): Example Code<br />

Use the dbexecutesql interface from the database for this functionality.<br />

Java (JDBC): Example Code<br />

public static void grantQueuePrivileges(Connection db_conn)<br />

{<br />

AQSession aq_sess;<br />

AQQueue sh_queue;<br />

AQQueue bi_queue;<br />

try<br />

{<br />

/* Create an AQ Session: */<br />

aq_sess = AQDriverManager.createAQSession(db_conn);<br />

/* Grant dequeue privilege on the shipped orders queue to the Customer<br />

Billing application. The CB application retrieves orders that are<br />

shipped but not billed from the shipped orders queue. */<br />

sh_queue = aq_sess.getQueue("CBADM", "CBADM_shippedorders_que");<br />

sh_queue.grantQueuePrivilege("DEQUEUE", "CB", false);<br />

/* Grant enqueue privilege on the billed orders queue to Customer<br />

Billing application.The CB application is allowed to put billed<br />

orders into this queue after processing the orders. */<br />

bi_queue = aq_sess.getQueue("CBADM", "CBADM_billedorders_que");<br />

bi_queue.grantQueuePrivilege("ENQUEUE", "CB", false);<br />

}<br />

catch (AQException ex)<br />

{<br />

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

A Sample Application Using AQ 8-5

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

Saved successfully!

Ooh no, something went wrong!