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.

General Features of JMS<br />

acknowledge() - acknowledges message receipt in a nontransacted session<br />

recover() - restarts message delivery in a nontransacted session. In effect, the<br />

<br />

series of delivered messages in the session are reset to the point after the last<br />

acknowledged message.<br />

The following are some of the extensions to JMS made by <strong>Oracle</strong>. The Session<br />

object has to be cast to AQjmsSession to use any of the extensions.<br />

QueueTables and Queues, Topics can be created from the Session object<br />

createQueueTable() - creates a queue table<br />

getQueueTable() - gets a handle to an existing queue table<br />

createQueue() - creates a queue<br />

getQueue() - gets a handle to an existing queue<br />

createTopic() - creates a topic<br />

getTopic() - gets a handle to an existing topic<br />

The following code illustrates how some of the preceding calls are used.<br />

Example Code<br />

public static void bol_example(String ora_sid, String host, int port,<br />

String driver)<br />

{<br />

QueueConnectionFactory qc_fact = null;<br />

QueueConnection q_conn = null;<br />

QueueSession q_sess = null;<br />

AQQueueTableProperty qt_prop = null;<br />

AQQueueTable q_table = null;<br />

AQjmsDestinationProperty dest_prop = null;<br />

Queue queue = null;<br />

BytesMessage bytes_msg = null;<br />

try<br />

{<br />

/* get queue connection factory */<br />

qc_fact = AQjmsFactory.getQueueConnectionFactory(host, ora_sid,<br />

port, driver);<br />

/* create queue connection */<br />

q_conn = qc_fact.createQueueConnection("boluser", "boluser");<br />

Creating Applications Using JMS 12-11

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

Saved successfully!

Ooh no, something went wrong!