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 JMS<br />

getExceptionListener() - get the ExceptionListener for this connection.<br />

Session<br />

A Connection is a factory for Sessions that use its underlying connection to a JMS<br />

provider for producing and consuming messages. A JMS Session is a single<br />

threaded context for producing and consuming messages. Although it may allocate<br />

provider resources outside the Java virtual machine, it is considered a light-weight<br />

JMS object.<br />

A Session serves several purposes:<br />

Constitutes a factory for its MessageProducers and MessageConsumers.<br />

<br />

Provides a way to get a handle to a destination objects (queues/topics)<br />

Supplies provider-optimized message factories<br />

Supports a single series of transactions that combines work spanning this<br />

<br />

session’s Producers and Consumers, organizing these into atomic units.<br />

Defines a serial order for the messages it consumes and the messages it<br />

<br />

produces.<br />

Serializes execution of MessageListeners registered with it.<br />

<br />

When you use the OCI JDBC driver, you can create multiple sessions for each<br />

connection. When you use other JDBC drivers, only one session can be created from<br />

one connection.<br />

Because a provider may allocate some resources on behalf of a session outside the<br />

JVM, clients should close them when they are not needed. Relying on garbage<br />

collection to eventually reclaim these resources may not be timely enough. The<br />

same is true for the MessageProducers and MessageConsumers created by a<br />

session.<br />

Methods on the Session object include:<br />

commit() - commits all messages performed in this transaction and releases<br />

<br />

locks currently held<br />

rollback() - rollsback any messages done in the transaction and release locks<br />

<br />

currently held<br />

close() - closes the session<br />

getDBConnection() - gets a handle to the underlying JDBC connection. This<br />

handle can be used to perform other SQL DML operations as part of the same<br />

session. The method is <strong>Oracle</strong> JMS specific.<br />

12-10 <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!