blob: 800bd815cc8bf25b42e4ece8400c70184cc07db9 [file] [log] [blame]
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<!-- NewPage -->
<html lang="en">
<head>
<title>JMSContext</title>
<link rel="stylesheet" type="text/css" href="../../stylesheet.css" title="Style">
<script type="text/javascript" src="../../script.js"></script>
</head>
<body>
<script type="text/javascript"><!--
try {
if (location.href.indexOf('is-external=true') == -1) {
parent.document.title="JMSContext";
}
}
catch(err) {
}
//-->
var methods = {"i0":6,"i1":6,"i2":6,"i3":6,"i4":6,"i5":6,"i6":6,"i7":6,"i8":6,"i9":6,"i10":6,"i11":6,"i12":6,"i13":6,"i14":6,"i15":6,"i16":6,"i17":6,"i18":6,"i19":6,"i20":6,"i21":6,"i22":6,"i23":6,"i24":6,"i25":6,"i26":6,"i27":6,"i28":6,"i29":6,"i30":6,"i31":6,"i32":6,"i33":6,"i34":6,"i35":6,"i36":6,"i37":6,"i38":6,"i39":6,"i40":6,"i41":6};
var tabs = {65535:["t0","All Methods"],2:["t2","Instance Methods"],4:["t3","Abstract Methods"]};
var altColor = "altColor";
var rowColor = "rowColor";
var tableTab = "tableTab";
var activeTableTab = "activeTableTab";
</script>
<noscript>
<div>JavaScript is disabled on your browser.</div>
</noscript>
<!-- ========= START OF TOP NAVBAR ======= -->
<div class="topNav"><a name="navbar.top">
<!-- -->
</a>
<div class="skipNav"><a href="#skip.navbar.top" title="Skip navigation links">Skip navigation links</a></div>
<a name="navbar.top.firstrow">
<!-- -->
</a>
<ul class="navList" title="Navigation">
<li><a href="../../overview-summary.html">Overview</a></li>
<li><a href="package-summary.html">Package</a></li>
<li class="navBarCell1Rev">Class</li>
<li><a href="package-tree.html">Tree</a></li>
<li><a href="../../deprecated-list.html">Deprecated</a></li>
<li><a href="../../index-all.html">Index</a></li>
<li><a href="../../help-doc.html">Help</a></li>
</ul>
</div>
<div class="subNav">
<ul class="navList">
<li><a href="../../javax/jms/JMSConsumer.html" title="interface in javax.jms"><span class="typeNameLink">Prev&nbsp;Class</span></a></li>
<li><a href="../../javax/jms/JMSDestinationDefinition.html" title="annotation in javax.jms"><span class="typeNameLink">Next&nbsp;Class</span></a></li>
</ul>
<ul class="navList">
<li><a href="../../index.html?javax/jms/JMSContext.html" target="_top">Frames</a></li>
<li><a href="JMSContext.html" target="_top">No&nbsp;Frames</a></li>
</ul>
<ul class="navList" id="allclasses_navbar_top">
<li><a href="../../allclasses-noframe.html">All&nbsp;Classes</a></li>
</ul>
<div>
<script type="text/javascript"><!--
allClassesLink = document.getElementById("allclasses_navbar_top");
if(window==top) {
allClassesLink.style.display = "block";
}
else {
allClassesLink.style.display = "none";
}
//-->
</script>
</div>
<div>
<ul class="subNavList">
<li>Summary:&nbsp;</li>
<li>Nested&nbsp;|&nbsp;</li>
<li><a href="#field.summary">Field</a>&nbsp;|&nbsp;</li>
<li>Constr&nbsp;|&nbsp;</li>
<li><a href="#method.summary">Method</a></li>
</ul>
<ul class="subNavList">
<li>Detail:&nbsp;</li>
<li><a href="#field.detail">Field</a>&nbsp;|&nbsp;</li>
<li>Constr&nbsp;|&nbsp;</li>
<li><a href="#method.detail">Method</a></li>
</ul>
</div>
<a name="skip.navbar.top">
<!-- -->
</a></div>
<!-- ========= END OF TOP NAVBAR ========= -->
<!-- ======== START OF CLASS DATA ======== -->
<div class="header">
<div class="subTitle">javax.jms</div>
<h2 title="Interface JMSContext" class="title">Interface JMSContext</h2>
</div>
<div class="contentContainer">
<div class="description">
<ul class="blockList">
<li class="blockList">
<dl>
<dt>All Superinterfaces:</dt>
<dd>java.lang.AutoCloseable</dd>
</dl>
<dl>
<dt>All Known Subinterfaces:</dt>
<dd><a href="../../javax/jms/XAJMSContext.html" title="interface in javax.jms">XAJMSContext</a></dd>
</dl>
<dl>
<dt>All Known Implementing Classes:</dt>
<dd><a href="../../org/apache/openejb/resource/activemq/jms2/cdi/JMS2CDIExtension.InternalJMSContext.html" title="class in org.apache.openejb.resource.activemq.jms2.cdi">JMS2CDIExtension.InternalJMSContext</a>, <a href="../../org/apache/openejb/resource/activemq/jms2/JMSContextImpl.html" title="class in org.apache.openejb.resource.activemq.jms2">JMSContextImpl</a>, <a href="../../org/apache/openejb/resource/activemq/jms2/XAJMSContextImpl.html" title="class in org.apache.openejb.resource.activemq.jms2">XAJMSContextImpl</a></dd>
</dl>
<hr>
<br>
<pre>public interface <span class="typeNameLabel">JMSContext</span>
extends java.lang.AutoCloseable</pre>
<div class="block">A <code>JMSContext</code> is the main interface in the simplified JMS API introduced for JMS 2.0. This combines in a
single object the functionality of two separate objects from the JMS 1.1 API: a <code>Connection</code> and a
<code>Session</code>.
<p>
When an application needs to send messages it use the <code>createProducer</code> method to create a <code>JMSProducer</code>
which provides methods to configure and send messages. Messages may be sent either synchronously or asynchronously.
<p>
When an application needs to receive messages it uses one of several <code>createConsumer</code> or
<code>createDurableConsumer</code> methods to create a <code>JMSConsumer</code> . A <code>JMSConsumer</code> provides methods to
receive messages either synchronously or asynchronously.
<p>
In terms of the JMS 1.1 API a <code>JMSContext</code> should be thought of as representing both a <code>Connection</code> and a
<code>Session</code>. Although the simplified API removes the need for applications to use those objects, the concepts of
connection and session remain important. A connection represents a physical link to the JMS server and a session
represents a single-threaded context for sending and receiving messages.
<p>
A <code>JMSContext</code> may be created by calling one of several <code>createContext</code> methods on a
<code>ConnectionFactory</code>. A <code>JMSContext</code> that is created in this way is described as being
<i>application-managed</i>. An application-managed <code>JMSContext</code> must be closed when no longer needed by calling
its <code>close</code> method.
<p>
Applications running in the Java EE web and EJB containers may alternatively inject a <code>JMSContext</code> into their
application using the <code>@Inject</code> annotation. A <code>JMSContext</code> that is created in this way is described as
being <i>container-managed</i>. A container-managed <code>JMSContext</code> will be closed automatically by the container.
<p>
Applications running in the Java EE web and EJB containers are not permitted to create more than one active session
on a connection so combining them in a single object takes advantage of this restriction to offer a simpler API.
<p>
However applications running in a Java SE environment or in the Java EE application client container are permitted to
create multiple active sessions on the same connection. This allows the same physical connection to be used in
multiple threads simultaneously. Such applications which require multiple sessions to be created on the same
connection should use one of the <code>createContext</code> methods on the <code>ConnectionFactory</code> to create the first
<code>JMSContext</code> and then use the <code>createContext</code> method on <code>JMSContext</code> to create additional
<code>JMSContext</code> objects that use the same connection. All these <code>JMSContext</code> objects are application-managed
and must be closed when no longer needed by calling their <code>close</code> method.</div>
<dl>
<dt><span class="simpleTagLabel">Since:</span></dt>
<dd>JMS 2.0</dd>
</dl>
</li>
</ul>
</div>
<div class="summary">
<ul class="blockList">
<li class="blockList">
<!-- =========== FIELD SUMMARY =========== -->
<ul class="blockList">
<li class="blockList"><a name="field.summary">
<!-- -->
</a>
<h3>Field Summary</h3>
<table class="memberSummary" border="0" cellpadding="3" cellspacing="0" summary="Field Summary table, listing fields, and an explanation">
<caption><span>Fields</span><span class="tabEnd">&nbsp;</span></caption>
<tr>
<th class="colFirst" scope="col">Modifier and Type</th>
<th class="colLast" scope="col">Field and Description</th>
</tr>
<tr class="altColor">
<td class="colFirst"><code>static int</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../javax/jms/JMSContext.html#AUTO_ACKNOWLEDGE">AUTO_ACKNOWLEDGE</a></span></code>
<div class="block">With this session mode, the JMSContext's session automatically acknowledges a client's receipt of a message either
when the session has successfully returned from a call to <code>receive</code> or when the message listener the session
has called to process the message successfully returns.</div>
</td>
</tr>
<tr class="rowColor">
<td class="colFirst"><code>static int</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../javax/jms/JMSContext.html#CLIENT_ACKNOWLEDGE">CLIENT_ACKNOWLEDGE</a></span></code>
<div class="block">With this session mode, the client acknowledges a consumed message by calling the message's <code>acknowledge</code>
method.</div>
</td>
</tr>
<tr class="altColor">
<td class="colFirst"><code>static int</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../javax/jms/JMSContext.html#DUPS_OK_ACKNOWLEDGE">DUPS_OK_ACKNOWLEDGE</a></span></code>
<div class="block">This session mode instructs the JMSContext's session to lazily acknowledge the delivery of messages.</div>
</td>
</tr>
<tr class="rowColor">
<td class="colFirst"><code>static int</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../javax/jms/JMSContext.html#SESSION_TRANSACTED">SESSION_TRANSACTED</a></span></code>
<div class="block">This session mode instructs the JMSContext's session to deliver and consume messages in a local transaction which
will be subsequently committed by calling <code>commit</code> or rolled back by calling <code>rollback</code>.</div>
</td>
</tr>
</table>
</li>
</ul>
<!-- ========== METHOD SUMMARY =========== -->
<ul class="blockList">
<li class="blockList"><a name="method.summary">
<!-- -->
</a>
<h3>Method Summary</h3>
<table class="memberSummary" border="0" cellpadding="3" cellspacing="0" summary="Method Summary table, listing methods, and an explanation">
<caption><span id="t0" class="activeTableTab"><span>All Methods</span><span class="tabEnd">&nbsp;</span></span><span id="t2" class="tableTab"><span><a href="javascript:show(2);">Instance Methods</a></span><span class="tabEnd">&nbsp;</span></span><span id="t3" class="tableTab"><span><a href="javascript:show(4);">Abstract Methods</a></span><span class="tabEnd">&nbsp;</span></span></caption>
<tr>
<th class="colFirst" scope="col">Modifier and Type</th>
<th class="colLast" scope="col">Method and Description</th>
</tr>
<tr id="i0" class="altColor">
<td class="colFirst"><code>void</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../javax/jms/JMSContext.html#acknowledge--">acknowledge</a></span>()</code>
<div class="block">Acknowledges all messages consumed by the JMSContext's session.</div>
</td>
</tr>
<tr id="i1" class="rowColor">
<td class="colFirst"><code>void</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../javax/jms/JMSContext.html#close--">close</a></span>()</code>
<div class="block">Closes the JMSContext</div>
</td>
</tr>
<tr id="i2" class="altColor">
<td class="colFirst"><code>void</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../javax/jms/JMSContext.html#commit--">commit</a></span>()</code>
<div class="block">Commits all messages done in this transaction and releases any locks currently held.</div>
</td>
</tr>
<tr id="i3" class="rowColor">
<td class="colFirst"><code><a href="../../javax/jms/QueueBrowser.html" title="interface in javax.jms">QueueBrowser</a></code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../javax/jms/JMSContext.html#createBrowser-javax.jms.Queue-">createBrowser</a></span>(<a href="../../javax/jms/Queue.html" title="interface in javax.jms">Queue</a>&nbsp;queue)</code>
<div class="block">Creates a <code>QueueBrowser</code> object to peek at the messages on the specified queue.</div>
</td>
</tr>
<tr id="i4" class="altColor">
<td class="colFirst"><code><a href="../../javax/jms/QueueBrowser.html" title="interface in javax.jms">QueueBrowser</a></code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../javax/jms/JMSContext.html#createBrowser-javax.jms.Queue-java.lang.String-">createBrowser</a></span>(<a href="../../javax/jms/Queue.html" title="interface in javax.jms">Queue</a>&nbsp;queue,
java.lang.String&nbsp;messageSelector)</code>
<div class="block">Creates a <code>QueueBrowser</code> object to peek at the messages on the specified queue using a message selector.</div>
</td>
</tr>
<tr id="i5" class="rowColor">
<td class="colFirst"><code><a href="../../javax/jms/BytesMessage.html" title="interface in javax.jms">BytesMessage</a></code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../javax/jms/JMSContext.html#createBytesMessage--">createBytesMessage</a></span>()</code>
<div class="block">Creates a <code>BytesMessage</code> object.</div>
</td>
</tr>
<tr id="i6" class="altColor">
<td class="colFirst"><code><a href="../../javax/jms/JMSConsumer.html" title="interface in javax.jms">JMSConsumer</a></code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../javax/jms/JMSContext.html#createConsumer-javax.jms.Destination-">createConsumer</a></span>(<a href="../../javax/jms/Destination.html" title="interface in javax.jms">Destination</a>&nbsp;destination)</code>
<div class="block">Creates a <code>JMSConsumer</code> for the specified destination.</div>
</td>
</tr>
<tr id="i7" class="rowColor">
<td class="colFirst"><code><a href="../../javax/jms/JMSConsumer.html" title="interface in javax.jms">JMSConsumer</a></code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../javax/jms/JMSContext.html#createConsumer-javax.jms.Destination-java.lang.String-">createConsumer</a></span>(<a href="../../javax/jms/Destination.html" title="interface in javax.jms">Destination</a>&nbsp;destination,
java.lang.String&nbsp;messageSelector)</code>
<div class="block">Creates a <code>JMSConsumer</code> for the specified destination, using a message selector.</div>
</td>
</tr>
<tr id="i8" class="altColor">
<td class="colFirst"><code><a href="../../javax/jms/JMSConsumer.html" title="interface in javax.jms">JMSConsumer</a></code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../javax/jms/JMSContext.html#createConsumer-javax.jms.Destination-java.lang.String-boolean-">createConsumer</a></span>(<a href="../../javax/jms/Destination.html" title="interface in javax.jms">Destination</a>&nbsp;destination,
java.lang.String&nbsp;messageSelector,
boolean&nbsp;noLocal)</code>
<div class="block">Creates a <code>JMSConsumer</code> for the specified destination, specifying a message selector and the <code>noLocal</code>
parameter.</div>
</td>
</tr>
<tr id="i9" class="rowColor">
<td class="colFirst"><code><a href="../../javax/jms/JMSContext.html" title="interface in javax.jms">JMSContext</a></code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../javax/jms/JMSContext.html#createContext-int-">createContext</a></span>(int&nbsp;sessionMode)</code>
<div class="block">Creates a new <code>JMSContext</code> with the specified session mode using the same connection as this <code>JMSContext</code>
and creating a new session.</div>
</td>
</tr>
<tr id="i10" class="altColor">
<td class="colFirst"><code><a href="../../javax/jms/JMSConsumer.html" title="interface in javax.jms">JMSConsumer</a></code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../javax/jms/JMSContext.html#createDurableConsumer-javax.jms.Topic-java.lang.String-">createDurableConsumer</a></span>(<a href="../../javax/jms/Topic.html" title="interface in javax.jms">Topic</a>&nbsp;topic,
java.lang.String&nbsp;name)</code>
<div class="block">Creates an unshared durable subscription on the specified topic (if one does not already exist) and creates a
consumer on that durable subscription.</div>
</td>
</tr>
<tr id="i11" class="rowColor">
<td class="colFirst"><code><a href="../../javax/jms/JMSConsumer.html" title="interface in javax.jms">JMSConsumer</a></code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../javax/jms/JMSContext.html#createDurableConsumer-javax.jms.Topic-java.lang.String-java.lang.String-boolean-">createDurableConsumer</a></span>(<a href="../../javax/jms/Topic.html" title="interface in javax.jms">Topic</a>&nbsp;topic,
java.lang.String&nbsp;name,
java.lang.String&nbsp;messageSelector,
boolean&nbsp;noLocal)</code>
<div class="block">Creates an unshared durable subscription on the specified topic (if one does not already exist), specifying a message
selector and the <code>noLocal</code> parameter, and creates a consumer on that durable subscription.</div>
</td>
</tr>
<tr id="i12" class="altColor">
<td class="colFirst"><code><a href="../../javax/jms/MapMessage.html" title="interface in javax.jms">MapMessage</a></code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../javax/jms/JMSContext.html#createMapMessage--">createMapMessage</a></span>()</code>
<div class="block">Creates a <code>MapMessage</code> object.</div>
</td>
</tr>
<tr id="i13" class="rowColor">
<td class="colFirst"><code><a href="../../javax/jms/Message.html" title="interface in javax.jms">Message</a></code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../javax/jms/JMSContext.html#createMessage--">createMessage</a></span>()</code>
<div class="block">Creates a <code>Message</code> object.</div>
</td>
</tr>
<tr id="i14" class="altColor">
<td class="colFirst"><code><a href="../../javax/jms/ObjectMessage.html" title="interface in javax.jms">ObjectMessage</a></code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../javax/jms/JMSContext.html#createObjectMessage--">createObjectMessage</a></span>()</code>
<div class="block">Creates an <code>ObjectMessage</code> object.</div>
</td>
</tr>
<tr id="i15" class="rowColor">
<td class="colFirst"><code><a href="../../javax/jms/ObjectMessage.html" title="interface in javax.jms">ObjectMessage</a></code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../javax/jms/JMSContext.html#createObjectMessage-java.io.Serializable-">createObjectMessage</a></span>(java.io.Serializable&nbsp;object)</code>
<div class="block">Creates an initialized <code>ObjectMessage</code> object.</div>
</td>
</tr>
<tr id="i16" class="altColor">
<td class="colFirst"><code><a href="../../javax/jms/JMSProducer.html" title="interface in javax.jms">JMSProducer</a></code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../javax/jms/JMSContext.html#createProducer--">createProducer</a></span>()</code>
<div class="block">Creates a new <code>JMSProducer</code> object which can be used to configure and send messages</div>
</td>
</tr>
<tr id="i17" class="rowColor">
<td class="colFirst"><code><a href="../../javax/jms/Queue.html" title="interface in javax.jms">Queue</a></code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../javax/jms/JMSContext.html#createQueue-java.lang.String-">createQueue</a></span>(java.lang.String&nbsp;queueName)</code>
<div class="block">Creates a <code>Queue</code> object which encapsulates a specified provider-specific queue name.</div>
</td>
</tr>
<tr id="i18" class="altColor">
<td class="colFirst"><code><a href="../../javax/jms/JMSConsumer.html" title="interface in javax.jms">JMSConsumer</a></code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../javax/jms/JMSContext.html#createSharedConsumer-javax.jms.Topic-java.lang.String-">createSharedConsumer</a></span>(<a href="../../javax/jms/Topic.html" title="interface in javax.jms">Topic</a>&nbsp;topic,
java.lang.String&nbsp;sharedSubscriptionName)</code>
<div class="block">Creates a shared non-durable subscription with the specified name on the specified topic (if one does not already
exist) and creates a consumer on that subscription.</div>
</td>
</tr>
<tr id="i19" class="rowColor">
<td class="colFirst"><code><a href="../../javax/jms/JMSConsumer.html" title="interface in javax.jms">JMSConsumer</a></code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../javax/jms/JMSContext.html#createSharedConsumer-javax.jms.Topic-java.lang.String-java.lang.String-">createSharedConsumer</a></span>(<a href="../../javax/jms/Topic.html" title="interface in javax.jms">Topic</a>&nbsp;topic,
java.lang.String&nbsp;sharedSubscriptionName,
java.lang.String&nbsp;messageSelector)</code>
<div class="block">Creates a shared non-durable subscription with the specified name on the specified topic (if one does not already
exist) specifying a message selector, and creates a consumer on that subscription.</div>
</td>
</tr>
<tr id="i20" class="altColor">
<td class="colFirst"><code><a href="../../javax/jms/JMSConsumer.html" title="interface in javax.jms">JMSConsumer</a></code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../javax/jms/JMSContext.html#createSharedDurableConsumer-javax.jms.Topic-java.lang.String-">createSharedDurableConsumer</a></span>(<a href="../../javax/jms/Topic.html" title="interface in javax.jms">Topic</a>&nbsp;topic,
java.lang.String&nbsp;name)</code>
<div class="block">Creates a shared durable subscription on the specified topic (if one does not already exist), specifying a message
selector, and creates a consumer on that durable subscription.</div>
</td>
</tr>
<tr id="i21" class="rowColor">
<td class="colFirst"><code><a href="../../javax/jms/JMSConsumer.html" title="interface in javax.jms">JMSConsumer</a></code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../javax/jms/JMSContext.html#createSharedDurableConsumer-javax.jms.Topic-java.lang.String-java.lang.String-">createSharedDurableConsumer</a></span>(<a href="../../javax/jms/Topic.html" title="interface in javax.jms">Topic</a>&nbsp;topic,
java.lang.String&nbsp;name,
java.lang.String&nbsp;messageSelector)</code>
<div class="block">Creates a shared durable subscription on the specified topic (if one does not already exist), specifying a message
selector, and creates a consumer on that durable subscription.</div>
</td>
</tr>
<tr id="i22" class="altColor">
<td class="colFirst"><code><a href="../../javax/jms/StreamMessage.html" title="interface in javax.jms">StreamMessage</a></code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../javax/jms/JMSContext.html#createStreamMessage--">createStreamMessage</a></span>()</code>
<div class="block">Creates a <code>StreamMessage</code> object.</div>
</td>
</tr>
<tr id="i23" class="rowColor">
<td class="colFirst"><code><a href="../../javax/jms/TemporaryQueue.html" title="interface in javax.jms">TemporaryQueue</a></code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../javax/jms/JMSContext.html#createTemporaryQueue--">createTemporaryQueue</a></span>()</code>
<div class="block">Creates a <code>TemporaryQueue</code> object.</div>
</td>
</tr>
<tr id="i24" class="altColor">
<td class="colFirst"><code><a href="../../javax/jms/TemporaryTopic.html" title="interface in javax.jms">TemporaryTopic</a></code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../javax/jms/JMSContext.html#createTemporaryTopic--">createTemporaryTopic</a></span>()</code>
<div class="block">Creates a <code>TemporaryTopic</code> object.</div>
</td>
</tr>
<tr id="i25" class="rowColor">
<td class="colFirst"><code><a href="../../javax/jms/TextMessage.html" title="interface in javax.jms">TextMessage</a></code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../javax/jms/JMSContext.html#createTextMessage--">createTextMessage</a></span>()</code>
<div class="block">Creates a <code>TextMessage</code> object.</div>
</td>
</tr>
<tr id="i26" class="altColor">
<td class="colFirst"><code><a href="../../javax/jms/TextMessage.html" title="interface in javax.jms">TextMessage</a></code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../javax/jms/JMSContext.html#createTextMessage-java.lang.String-">createTextMessage</a></span>(java.lang.String&nbsp;text)</code>
<div class="block">Creates an initialized <code>TextMessage</code> object.</div>
</td>
</tr>
<tr id="i27" class="rowColor">
<td class="colFirst"><code><a href="../../javax/jms/Topic.html" title="interface in javax.jms">Topic</a></code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../javax/jms/JMSContext.html#createTopic-java.lang.String-">createTopic</a></span>(java.lang.String&nbsp;topicName)</code>
<div class="block">Creates a <code>Topic</code> object which encapsulates a specified provider-specific topic name.</div>
</td>
</tr>
<tr id="i28" class="altColor">
<td class="colFirst"><code>boolean</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../javax/jms/JMSContext.html#getAutoStart--">getAutoStart</a></span>()</code>
<div class="block">Returns whether the underlying connection used by this <code>JMSContext</code> will be started automatically when a
consumer is created.</div>
</td>
</tr>
<tr id="i29" class="rowColor">
<td class="colFirst"><code>java.lang.String</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../javax/jms/JMSContext.html#getClientID--">getClientID</a></span>()</code>
<div class="block">Gets the client identifier for the JMSContext's connection.</div>
</td>
</tr>
<tr id="i30" class="altColor">
<td class="colFirst"><code><a href="../../javax/jms/ExceptionListener.html" title="interface in javax.jms">ExceptionListener</a></code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../javax/jms/JMSContext.html#getExceptionListener--">getExceptionListener</a></span>()</code>
<div class="block">Gets the <code>ExceptionListener</code> object for the JMSContext's connection.</div>
</td>
</tr>
<tr id="i31" class="rowColor">
<td class="colFirst"><code><a href="../../javax/jms/ConnectionMetaData.html" title="interface in javax.jms">ConnectionMetaData</a></code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../javax/jms/JMSContext.html#getMetaData--">getMetaData</a></span>()</code>
<div class="block">Gets the connection metadata for the JMSContext's connection.</div>
</td>
</tr>
<tr id="i32" class="altColor">
<td class="colFirst"><code>int</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../javax/jms/JMSContext.html#getSessionMode--">getSessionMode</a></span>()</code>
<div class="block">Returns the session mode of the JMSContext's session.</div>
</td>
</tr>
<tr id="i33" class="rowColor">
<td class="colFirst"><code>boolean</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../javax/jms/JMSContext.html#getTransacted--">getTransacted</a></span>()</code>
<div class="block">Indicates whether the JMSContext's session is in transacted mode.</div>
</td>
</tr>
<tr id="i34" class="altColor">
<td class="colFirst"><code>void</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../javax/jms/JMSContext.html#recover--">recover</a></span>()</code>
<div class="block">Stops message delivery in the JMSContext's session, and restarts message delivery with the oldest unacknowledged
message.</div>
</td>
</tr>
<tr id="i35" class="rowColor">
<td class="colFirst"><code>void</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../javax/jms/JMSContext.html#rollback--">rollback</a></span>()</code>
<div class="block">Rolls back any messages done in this transaction and releases any locks currently held.</div>
</td>
</tr>
<tr id="i36" class="altColor">
<td class="colFirst"><code>void</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../javax/jms/JMSContext.html#setAutoStart-boolean-">setAutoStart</a></span>(boolean&nbsp;autoStart)</code>
<div class="block">Specifies whether the underlying connection used by this <code>JMSContext</code> will be started automatically when a
consumer is created.</div>
</td>
</tr>
<tr id="i37" class="rowColor">
<td class="colFirst"><code>void</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../javax/jms/JMSContext.html#setClientID-java.lang.String-">setClientID</a></span>(java.lang.String&nbsp;clientID)</code>
<div class="block">Sets the client identifier for the JMSContext's connection.</div>
</td>
</tr>
<tr id="i38" class="altColor">
<td class="colFirst"><code>void</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../javax/jms/JMSContext.html#setExceptionListener-javax.jms.ExceptionListener-">setExceptionListener</a></span>(<a href="../../javax/jms/ExceptionListener.html" title="interface in javax.jms">ExceptionListener</a>&nbsp;listener)</code>
<div class="block">Sets an exception listener for the JMSContext's connection.</div>
</td>
</tr>
<tr id="i39" class="rowColor">
<td class="colFirst"><code>void</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../javax/jms/JMSContext.html#start--">start</a></span>()</code>
<div class="block">Starts (or restarts) delivery of incoming messages by the JMSContext's connection.</div>
</td>
</tr>
<tr id="i40" class="altColor">
<td class="colFirst"><code>void</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../javax/jms/JMSContext.html#stop--">stop</a></span>()</code>
<div class="block">Temporarily stops the delivery of incoming messages by the JMSContext's connection.</div>
</td>
</tr>
<tr id="i41" class="rowColor">
<td class="colFirst"><code>void</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../javax/jms/JMSContext.html#unsubscribe-java.lang.String-">unsubscribe</a></span>(java.lang.String&nbsp;name)</code>
<div class="block">Unsubscribes a durable subscription that has been created by a client.</div>
</td>
</tr>
</table>
</li>
</ul>
</li>
</ul>
</div>
<div class="details">
<ul class="blockList">
<li class="blockList">
<!-- ============ FIELD DETAIL =========== -->
<ul class="blockList">
<li class="blockList"><a name="field.detail">
<!-- -->
</a>
<h3>Field Detail</h3>
<a name="AUTO_ACKNOWLEDGE">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>AUTO_ACKNOWLEDGE</h4>
<pre>static final&nbsp;int AUTO_ACKNOWLEDGE</pre>
<div class="block">With this session mode, the JMSContext's session automatically acknowledges a client's receipt of a message either
when the session has successfully returned from a call to <code>receive</code> or when the message listener the session
has called to process the message successfully returns.</div>
<dl>
<dt><span class="seeLabel">See Also:</span></dt>
<dd><a href="../../constant-values.html#javax.jms.JMSContext.AUTO_ACKNOWLEDGE">Constant Field Values</a></dd>
</dl>
</li>
</ul>
<a name="CLIENT_ACKNOWLEDGE">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>CLIENT_ACKNOWLEDGE</h4>
<pre>static final&nbsp;int CLIENT_ACKNOWLEDGE</pre>
<div class="block">With this session mode, the client acknowledges a consumed message by calling the message's <code>acknowledge</code>
method. Acknowledging a consumed message acknowledges all messages that the session has consumed.
<p>
When this session mode is used, a client may build up a large number of unacknowledged messages while attempting to
process them. A JMS provider should provide administrators with a way to limit client overrun so that clients are not
driven to resource exhaustion and ensuing failure when some resource they are using is temporarily blocked.</div>
<dl>
<dt><span class="seeLabel">See Also:</span></dt>
<dd><a href="../../javax/jms/Message.html#acknowledge--"><code>Message.acknowledge()</code></a>,
<a href="../../constant-values.html#javax.jms.JMSContext.CLIENT_ACKNOWLEDGE">Constant Field Values</a></dd>
</dl>
</li>
</ul>
<a name="DUPS_OK_ACKNOWLEDGE">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>DUPS_OK_ACKNOWLEDGE</h4>
<pre>static final&nbsp;int DUPS_OK_ACKNOWLEDGE</pre>
<div class="block">This session mode instructs the JMSContext's session to lazily acknowledge the delivery of messages. This is likely
to result in the delivery of some duplicate messages if the JMS provider fails, so it should only be used by
consumers that can tolerate duplicate messages. Use of this mode can reduce session overhead by minimizing the work
the session does to prevent duplicates.</div>
<dl>
<dt><span class="seeLabel">See Also:</span></dt>
<dd><a href="../../constant-values.html#javax.jms.JMSContext.DUPS_OK_ACKNOWLEDGE">Constant Field Values</a></dd>
</dl>
</li>
</ul>
<a name="SESSION_TRANSACTED">
<!-- -->
</a>
<ul class="blockListLast">
<li class="blockList">
<h4>SESSION_TRANSACTED</h4>
<pre>static final&nbsp;int SESSION_TRANSACTED</pre>
<div class="block">This session mode instructs the JMSContext's session to deliver and consume messages in a local transaction which
will be subsequently committed by calling <code>commit</code> or rolled back by calling <code>rollback</code>.</div>
<dl>
<dt><span class="seeLabel">See Also:</span></dt>
<dd><a href="../../constant-values.html#javax.jms.JMSContext.SESSION_TRANSACTED">Constant Field Values</a></dd>
</dl>
</li>
</ul>
</li>
</ul>
<!-- ============ METHOD DETAIL ========== -->
<ul class="blockList">
<li class="blockList"><a name="method.detail">
<!-- -->
</a>
<h3>Method Detail</h3>
<a name="createContext-int-">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>createContext</h4>
<pre><a href="../../javax/jms/JMSContext.html" title="interface in javax.jms">JMSContext</a>&nbsp;createContext(int&nbsp;sessionMode)</pre>
<div class="block">Creates a new <code>JMSContext</code> with the specified session mode using the same connection as this <code>JMSContext</code>
and creating a new session.
<p>
This method does not start the connection. If the connection has not already been started then it will be
automatically started when a <code>JMSConsumer</code> is created on any of the <code>JMSContext</code> objects for that
connection.
<ul>
<li>If <code>sessionMode</code> is set to <code>JMSContext.SESSION_TRANSACTED</code> then the session will use a local
transaction which may subsequently be committed or rolled back by calling the <code>JMSContext</code>'s <code>commit</code> or
<code>rollback</code> methods.
<li>If <code>sessionMode</code> is set to any of <code>JMSContext.CLIENT_ACKNOWLEDGE</code>,
<code>JMSContext.AUTO_ACKNOWLEDGE</code> or <code>JMSContext.DUPS_OK_ACKNOWLEDGE</code>. then the session will be
non-transacted and messages received by this session will be acknowledged according to the value of
<code>sessionMode</code>. For a definition of the meaning of these acknowledgement modes see the links below.
</ul>
<p>
This method must not be used by applications running in the Java EE web or EJB containers because doing so would
violate the restriction that such an application must not attempt to create more than one active (not closed)
<code>Session</code> object per connection. If this method is called in a Java EE web or EJB container then a
<code>JMSRuntimeException</code> will be thrown.</div>
<dl>
<dt><span class="paramLabel">Parameters:</span></dt>
<dd><code>sessionMode</code> - indicates which of four possible session modes will be used. The permitted values are
<code>JMSContext.SESSION_TRANSACTED</code>, <code>JMSContext.CLIENT_ACKNOWLEDGE</code>, <code>JMSContext.AUTO_ACKNOWLEDGE</code> and
<code>JMSContext.DUPS_OK_ACKNOWLEDGE</code>.</dd>
<dt><span class="returnLabel">Returns:</span></dt>
<dd>a newly created JMSContext</dd>
<dt><span class="throwsLabel">Throws:</span></dt>
<dd><code><a href="../../javax/jms/JMSRuntimeException.html" title="class in javax.jms">JMSRuntimeException</a></code> - if the JMS provider fails to create the JMSContext due to
<ul>
<li>some internal error or
<li>because this method is being called in a Java EE web or EJB application.
</ul></dd>
<dt><span class="simpleTagLabel">Since:</span></dt>
<dd>JMS 2.0</dd>
<dt><span class="seeLabel">See Also:</span></dt>
<dd><a href="../../javax/jms/JMSContext.html#SESSION_TRANSACTED"><code>SESSION_TRANSACTED</code></a>,
<a href="../../javax/jms/JMSContext.html#CLIENT_ACKNOWLEDGE"><code>CLIENT_ACKNOWLEDGE</code></a>,
<a href="../../javax/jms/JMSContext.html#AUTO_ACKNOWLEDGE"><code>AUTO_ACKNOWLEDGE</code></a>,
<a href="../../javax/jms/JMSContext.html#DUPS_OK_ACKNOWLEDGE"><code>DUPS_OK_ACKNOWLEDGE</code></a>,
<a href="../../javax/jms/ConnectionFactory.html#createContext--"><code>ConnectionFactory.createContext()</code></a>,
<a href="../../javax/jms/ConnectionFactory.html#createContext-int-"><code>ConnectionFactory.createContext(int)</code></a>,
<a href="../../javax/jms/ConnectionFactory.html#createContext-java.lang.String-java.lang.String-"><code>ConnectionFactory.createContext(java.lang.String, java.lang.String)</code></a>,
<a href="../../javax/jms/ConnectionFactory.html#createContext-java.lang.String-java.lang.String-int-"><code>ConnectionFactory.createContext(java.lang.String, java.lang.String, int)</code></a>,
<a href="../../javax/jms/JMSContext.html#createContext-int-"><code>createContext(int)</code></a></dd>
</dl>
</li>
</ul>
<a name="createProducer--">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>createProducer</h4>
<pre><a href="../../javax/jms/JMSProducer.html" title="interface in javax.jms">JMSProducer</a>&nbsp;createProducer()</pre>
<div class="block">Creates a new <code>JMSProducer</code> object which can be used to configure and send messages</div>
<dl>
<dt><span class="returnLabel">Returns:</span></dt>
<dd>A new <code>JMSProducer</code> object</dd>
<dt><span class="seeLabel">See Also:</span></dt>
<dd><a href="../../javax/jms/JMSProducer.html" title="interface in javax.jms"><code>JMSProducer</code></a></dd>
</dl>
</li>
</ul>
<a name="getClientID--">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>getClientID</h4>
<pre>java.lang.String&nbsp;getClientID()</pre>
<div class="block">Gets the client identifier for the JMSContext's connection.
<p>
This value is specific to the JMS provider. It is either preconfigured by an administrator in a
<code>ConnectionFactory</code> object or assigned dynamically by the application by calling the <code>setClientID</code>
method.</div>
<dl>
<dt><span class="returnLabel">Returns:</span></dt>
<dd>the unique client identifier</dd>
<dt><span class="throwsLabel">Throws:</span></dt>
<dd><code><a href="../../javax/jms/JMSRuntimeException.html" title="class in javax.jms">JMSRuntimeException</a></code> - if the JMS provider fails to return the client ID for the JMSContext's connection due
to some internal error.</dd>
</dl>
</li>
</ul>
<a name="setClientID-java.lang.String-">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>setClientID</h4>
<pre>void&nbsp;setClientID(java.lang.String&nbsp;clientID)</pre>
<div class="block">Sets the client identifier for the JMSContext's connection.
<p>
The preferred way to assign a JMS client's client identifier is for it to be configured in a client-specific
<code>ConnectionFactory</code> object and transparently assigned to the <code>Connection</code> object it creates.
<p>
Alternatively, a client can set the client identifier for the JMSContext's connection using a provider-specific
value. The facility to set its client identifier explicitly is not a mechanism for overriding the identifier that has
been administratively configured. It is provided for the case where no administratively specified identifier exists.
If one does exist, an attempt to change it by setting it must throw an <code>IllegalStateRuntimeException</code>. If a
client sets the client identifier explicitly, it must do so immediately after it creates the JMSContext and before
any other action on the JMSContext is taken. After this point, setting the client identifier is a programming error
that should throw an <code>IllegalStateRuntimeException</code>.
<p>
The purpose of the client identifier is to associate the JMSContext's connection and its objects with a state
maintained on behalf of the client by a provider. The only such state identified by the JMS API is that required to
support durable subscriptions.
<p>
If another connection with the same <code>clientID</code> is already running when this method is called, the JMS provider
should detect the duplicate ID and throw an <code>InvalidClientIDException</code>.
<p>
This method must not be used in a Java EE web or EJB application. Doing so may cause a <code>JMSRuntimeException</code> to
be thrown though this is not guaranteed.
<p>
This method must not be used if the <code>JMSContext</code> is container-managed (injected). Doing so will cause a
<code>IllegalStateRuntimeException</code> to be thrown.</div>
<dl>
<dt><span class="paramLabel">Parameters:</span></dt>
<dd><code>clientID</code> - the unique client identifier</dd>
<dt><span class="throwsLabel">Throws:</span></dt>
<dd><code><a href="../../javax/jms/InvalidClientIDRuntimeException.html" title="class in javax.jms">InvalidClientIDRuntimeException</a></code> - if the JMS client specifies an invalid or duplicate client ID.</dd>
<dd><code><a href="../../javax/jms/IllegalStateRuntimeException.html" title="class in javax.jms">IllegalStateRuntimeException</a></code> - <ul>
<li>if the JMS client attempts to set the client ID for the JMSContext's connection at the wrong time or
<li>if the client ID has been administratively configured or
<li>if the <code>JMSContext</code> is container-managed (injected).
</ul></dd>
<dd><code><a href="../../javax/jms/JMSRuntimeException.html" title="class in javax.jms">JMSRuntimeException</a></code> - if the JMS provider fails to set the client ID for the the JMSContext's connection for
one of the following reasons:
<ul>
<li>an internal error has occurred or
<li>this method has been called in a Java EE web or EJB application (though it is not guaranteed that an exception is
thrown in this case)
</ul></dd>
</dl>
</li>
</ul>
<a name="getMetaData--">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>getMetaData</h4>
<pre><a href="../../javax/jms/ConnectionMetaData.html" title="interface in javax.jms">ConnectionMetaData</a>&nbsp;getMetaData()</pre>
<div class="block">Gets the connection metadata for the JMSContext's connection.</div>
<dl>
<dt><span class="returnLabel">Returns:</span></dt>
<dd>the connection metadata</dd>
<dt><span class="throwsLabel">Throws:</span></dt>
<dd><code><a href="../../javax/jms/JMSRuntimeException.html" title="class in javax.jms">JMSRuntimeException</a></code> - if the JMS provider fails to get the connection metadata</dd>
<dt><span class="seeLabel">See Also:</span></dt>
<dd><a href="../../javax/jms/ConnectionMetaData.html" title="interface in javax.jms"><code>ConnectionMetaData</code></a></dd>
</dl>
</li>
</ul>
<a name="getExceptionListener--">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>getExceptionListener</h4>
<pre><a href="../../javax/jms/ExceptionListener.html" title="interface in javax.jms">ExceptionListener</a>&nbsp;getExceptionListener()</pre>
<div class="block">Gets the <code>ExceptionListener</code> object for the JMSContext's connection. Not every <code>Connection</code> has an
<code>ExceptionListener</code> associated with it.</div>
<dl>
<dt><span class="returnLabel">Returns:</span></dt>
<dd>the <code>ExceptionListener</code> for the JMSContext's connection, or null if no <code>ExceptionListener</code> is
associated with that connection.</dd>
<dt><span class="throwsLabel">Throws:</span></dt>
<dd><code><a href="../../javax/jms/JMSRuntimeException.html" title="class in javax.jms">JMSRuntimeException</a></code> - if the JMS provider fails to get the <code>ExceptionListener</code> for the JMSContext's
connection.</dd>
<dt><span class="seeLabel">See Also:</span></dt>
<dd><a href="../../javax/jms/Connection.html#setExceptionListener-javax.jms.ExceptionListener-"><code>Connection.setExceptionListener(javax.jms.ExceptionListener)</code></a></dd>
</dl>
</li>
</ul>
<a name="setExceptionListener-javax.jms.ExceptionListener-">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>setExceptionListener</h4>
<pre>void&nbsp;setExceptionListener(<a href="../../javax/jms/ExceptionListener.html" title="interface in javax.jms">ExceptionListener</a>&nbsp;listener)</pre>
<div class="block">Sets an exception listener for the JMSContext's connection.
<p>
If a JMS provider detects a serious problem with a connection, it informs the connection's <code>ExceptionListener</code>,
if one has been registered. It does this by calling the listener's <code>onException</code> method, passing it a
<code>JMSRuntimeException</code> object describing the problem.
<p>
An exception listener allows a client to be notified of a problem asynchronously. Some connections only consume
messages, so they would have no other way to learn their connection has failed.
<p>
A connection serializes execution of its <code>ExceptionListener</code>.
<p>
A JMS provider should attempt to resolve connection problems itself before it notifies the client of them.
<p>
This method must not be used in a Java EE web or EJB application. Doing so may cause a <code>JMSRuntimeException</code> to
be thrown though this is not guaranteed.
<p>
This method must not be used if the <code>JMSContext</code> is container-managed (injected). Doing so will cause a
<code>IllegalStateRuntimeException</code> to be thrown.</div>
<dl>
<dt><span class="paramLabel">Parameters:</span></dt>
<dd><code>listener</code> - the exception listener</dd>
<dt><span class="throwsLabel">Throws:</span></dt>
<dd><code><a href="../../javax/jms/IllegalStateRuntimeException.html" title="class in javax.jms">IllegalStateRuntimeException</a></code> - if the <code>JMSContext</code> is container-managed (injected).</dd>
<dd><code><a href="../../javax/jms/JMSRuntimeException.html" title="class in javax.jms">JMSRuntimeException</a></code> - if the JMS provider fails to set the exception listener for one of the following
reasons:
<ul>
<li>an internal error has occurred or
<li>this method has been called in a Java EE web or EJB application (though it is not guaranteed that an exception is
thrown in this case)
</ul></dd>
</dl>
</li>
</ul>
<a name="start--">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>start</h4>
<pre>void&nbsp;start()</pre>
<div class="block">Starts (or restarts) delivery of incoming messages by the JMSContext's connection. A call to <code>start</code> on a
connection that has already been started is ignored.
<p>
This method must not be used if the <code>JMSContext</code> is container-managed (injected). Doing so will cause a
<code>IllegalStateRuntimeException</code> to be thrown.</div>
<dl>
<dt><span class="throwsLabel">Throws:</span></dt>
<dd><code><a href="../../javax/jms/IllegalStateRuntimeException.html" title="class in javax.jms">IllegalStateRuntimeException</a></code> - if the <code>JMSContext</code> is container-managed (injected).</dd>
<dd><code><a href="../../javax/jms/JMSRuntimeException.html" title="class in javax.jms">JMSRuntimeException</a></code> - if the JMS provider fails to start message delivery due to some internal error.</dd>
<dt><span class="seeLabel">See Also:</span></dt>
<dd><a href="../../javax/jms/JMSContext.html#stop--"><code>stop()</code></a></dd>
</dl>
</li>
</ul>
<a name="stop--">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>stop</h4>
<pre>void&nbsp;stop()</pre>
<div class="block">Temporarily stops the delivery of incoming messages by the JMSContext's connection. Delivery can be restarted using
the <code>start</code> method. When the connection is stopped, delivery to all the connection's message consumers is
inhibited: synchronous receives block, and messages are not delivered to message listeners.
<p>
Stopping a connection has no effect on its ability to send messages. A call to <code>stop</code> on a connection that has
already been stopped is ignored.
<p>
A call to <code>stop</code> must not return until delivery of messages has paused. This means that a client can rely on
the fact that none of its message listeners will be called and that all threads of control waiting for
<code>receive</code> calls to return will not return with a message until the connection is restarted. The receive timers
for a stopped connection continue to advance, so receives may time out while the connection is stopped.
<p>
If message listeners are running when <code>stop</code> is invoked, the <code>stop</code> call must wait until all of them have
returned before it may return. While these message listeners are completing, they must have the full services of the
connection available to them.
<p>
However if the stop method is called from a message listener on its own <code>JMSContext</code>, or any other
<code>JMSContext</code> that uses the same connection, then it will either fail and throw a
<code>javax.jms.IllegalStateRuntimeException</code>, or it will succeed and stop the connection, blocking until all other
message listeners that may have been running have returned.
<p>
Since two alternative behaviors are permitted in this case, applications should avoid calling <code>stop</code> from a
message listener on its own <code>JMSContext</code>, or any other <code>JMSContext</code> that uses the same connection,
because this is not portable.
<p>
For the avoidance of doubt, if an exception listener for the JMSContext's connection is running when <code>stop</code> is
invoked, there is no requirement for the <code>stop</code> call to wait until the exception listener has returned before
it may return.
<p>
This method must not be used in a Java EE web or EJB application. Doing so may cause a <code>JMSRuntimeException</code> to
be thrown though this is not guaranteed.
<p>
This method must not be used if the <code>JMSContext</code> is container-managed (injected). Doing so will cause a
<code>IllegalStateRuntimeException</code> to be thrown.</div>
<dl>
<dt><span class="throwsLabel">Throws:</span></dt>
<dd><code><a href="../../javax/jms/IllegalStateRuntimeException.html" title="class in javax.jms">IllegalStateRuntimeException</a></code> - <ul>
<li>if this method has been called by a <tt>MessageListener</tt> on its own <tt>JMSContext</tt>
<li>if the <code>JMSContext</code> is container-managed (injected).
</ul></dd>
<dd><code><a href="../../javax/jms/JMSRuntimeException.html" title="class in javax.jms">JMSRuntimeException</a></code> - if the JMS provider fails to stop message delivery for one of the following reasons:
<ul>
<li>an internal error has occurred or
<li>this method has been called in a Java EE web or EJB application (though it is not guaranteed that an exception is
thrown in this case)
</ul></dd>
<dt><span class="seeLabel">See Also:</span></dt>
<dd><a href="../../javax/jms/JMSContext.html#start--"><code>start()</code></a></dd>
</dl>
</li>
</ul>
<a name="setAutoStart-boolean-">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>setAutoStart</h4>
<pre>void&nbsp;setAutoStart(boolean&nbsp;autoStart)</pre>
<div class="block">Specifies whether the underlying connection used by this <code>JMSContext</code> will be started automatically when a
consumer is created. This is the default behaviour, and it may be disabled by calling this method with a value of
<code>false</code>.
<p>
This method does not itself either start or stop the connection.
<p>
This method must not be used if the <code>JMSContext</code> is container-managed (injected). Doing so will cause a
<code>IllegalStateRuntimeException</code> to be thrown.</div>
<dl>
<dt><span class="paramLabel">Parameters:</span></dt>
<dd><code>autoStart</code> - Whether the underlying connection used by this <code>JMSContext</code> will be automatically started when
a consumer is created.</dd>
<dt><span class="throwsLabel">Throws:</span></dt>
<dd><code><a href="../../javax/jms/IllegalStateRuntimeException.html" title="class in javax.jms">IllegalStateRuntimeException</a></code> - if the <code>JMSContext</code> is container-managed (injected)</dd>
<dt><span class="seeLabel">See Also:</span></dt>
<dd><a href="../../javax/jms/JMSContext.html#getAutoStart--"><code>getAutoStart()</code></a></dd>
</dl>
</li>
</ul>
<a name="getAutoStart--">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>getAutoStart</h4>
<pre>boolean&nbsp;getAutoStart()</pre>
<div class="block">Returns whether the underlying connection used by this <code>JMSContext</code> will be started automatically when a
consumer is created.</div>
<dl>
<dt><span class="returnLabel">Returns:</span></dt>
<dd>whether the underlying connection used by this <code>JMSContext</code> will be started automatically when a
consumer is created.</dd>
<dt><span class="seeLabel">See Also:</span></dt>
<dd><a href="../../javax/jms/JMSContext.html#setAutoStart-boolean-"><code>setAutoStart(boolean)</code></a></dd>
</dl>
</li>
</ul>
<a name="close--">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>close</h4>
<pre>void&nbsp;close()</pre>
<div class="block">Closes the JMSContext
<p>
This closes the underlying session and any underlying producers and consumers. If there are no other active (not
closed) JMSContext objects using the underlying connection then this method also closes the underlying connection.
<p>
Since a provider typically allocates significant resources outside the JVM on behalf of a connection, clients should
close these resources when they are not needed. Relying on garbage collection to eventually reclaim these resources
may not be timely enough.
<p>
Closing a connection causes all temporary destinations to be deleted.
<p>
When this method is invoked, it should not return until message processing has been shut down in an orderly fashion.
This means that all message listeners that may have been running have returned, and that all pending receives have
returned. A close terminates all pending message receives on the connection's sessions' consumers. The receives may
return with a message or with null, depending on whether there was a message available at the time of the close. If
one or more of the connection's sessions' message listeners is processing a message at the time when connection
<code>close</code> is invoked, all the facilities of the connection and its sessions must remain available to those
listeners until they return control to the JMS provider.
<p>
However if the close method is called from a message listener on its own <code>JMSContext</code>, then it will either fail
and throw a <code>javax.jms.IllegalStateRuntimeException</code>, or it will succeed and close the <code>JMSContext</code>. If
<code>close</code> succeeds and the session mode of the <code>JMSContext</code> is set to <code>AUTO_ACKNOWLEDGE</code>, the current
message will still be acknowledged automatically when the onMessage call completes.
<p>
Since two alternative behaviors are permitted in this case, applications should avoid calling close from a message
listener on its own <code>JMSContext</code> because this is not portable.
<p>
This method must not return until any incomplete asynchronous send operations for this <tt>JMSContext</tt> have been
completed and any <tt>CompletionListener</tt> callbacks have returned. Incomplete sends should be allowed to complete
normally unless an error occurs.
<p>
For the avoidance of doubt, if an exception listener for the JMSContext's connection is running when <code>close</code> is
invoked, there is no requirement for the <code>close</code> call to wait until the exception listener has returned before
it may return.
<p>
Closing a connection causes any of its sessions' transactions in progress to be rolled back. In the case where a
session's work is coordinated by an external transaction manager, a session's <code>commit</code> and <code>rollback</code>
methods are not used and the result of a closed session's work is determined later by the transaction manager.
<p>
Closing a connection does NOT force an acknowledgment of client-acknowledged sessions.
<p>
Invoking the <code>acknowledge</code> method of a received message from a closed connection's session must throw an
<code>IllegalStateRuntimeException</code>. Closing a closed connection must NOT throw an exception.
<p>
A <tt>CompletionListener</tt> callback method must not call <tt>close</tt> on its own <tt>JMSContext</tt>. Doing so
will cause an <tt>IllegalStateRuntimeException</tt> to be thrown.
<p>
This method must not be used if the <code>JMSContext</code> is container-managed (injected). Doing so will cause a
<code>IllegalStateRuntimeException</code> to be thrown.</div>
<dl>
<dt><span class="overrideSpecifyLabel">Specified by:</span></dt>
<dd><code>close</code>&nbsp;in interface&nbsp;<code>java.lang.AutoCloseable</code></dd>
<dt><span class="throwsLabel">Throws:</span></dt>
<dd><code><a href="../../javax/jms/IllegalStateRuntimeException.html" title="class in javax.jms">IllegalStateRuntimeException</a></code> - <ul>
<li>if this method has been called by a <tt>MessageListener
</tt> on its own <tt>JMSContext</tt></li>
<li>if this method has been called by a <tt>CompletionListener</tt> callback method on its own
<tt>JMSContext</tt></li>
<li>if the <code>JMSContext</code> is container-managed (injected)</li>
</ul></dd>
<dd><code><a href="../../javax/jms/JMSRuntimeException.html" title="class in javax.jms">JMSRuntimeException</a></code> - if the JMS provider fails to close the <code>JMSContext</code> due to some internal error.
For example, a failure to release resources or to close a socket connection can cause this exception to be thrown.</dd>
</dl>
</li>
</ul>
<a name="createBytesMessage--">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>createBytesMessage</h4>
<pre><a href="../../javax/jms/BytesMessage.html" title="interface in javax.jms">BytesMessage</a>&nbsp;createBytesMessage()</pre>
<div class="block">Creates a <code>BytesMessage</code> object. A <code>BytesMessage</code> object is used to send a message containing a stream of
uninterpreted bytes.</div>
<dl>
<dt><span class="returnLabel">Returns:</span></dt>
<dd>The created <code>BytesMessage</code> object</dd>
<dt><span class="throwsLabel">Throws:</span></dt>
<dd><code><a href="../../javax/jms/JMSRuntimeException.html" title="class in javax.jms">JMSRuntimeException</a></code> - if the JMS provider fails to create this message due to some internal error.</dd>
</dl>
</li>
</ul>
<a name="createMapMessage--">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>createMapMessage</h4>
<pre><a href="../../javax/jms/MapMessage.html" title="interface in javax.jms">MapMessage</a>&nbsp;createMapMessage()</pre>
<div class="block">Creates a <code>MapMessage</code> object. A <code>MapMessage</code> object is used to send a self-defining set of name-value
pairs, where names are <code>String</code> objects and values are primitive values in the Java programming language.
<p>
The message object returned may be sent using any <code>Session</code> or <code>JMSContext</code>. It is not restricted to
being sent using the <code>JMSContext</code> used to create it.
<p>
The message object returned may be optimised for use with the JMS provider used to create it. However it can be sent
using any JMS provider, not just the JMS provider used to create it.</div>
<dl>
<dt><span class="returnLabel">Returns:</span></dt>
<dd>The created <code>MapMessage</code> object.</dd>
<dt><span class="throwsLabel">Throws:</span></dt>
<dd><code><a href="../../javax/jms/JMSRuntimeException.html" title="class in javax.jms">JMSRuntimeException</a></code> - if the JMS provider fails to create this message due to some internal error.</dd>
</dl>
</li>
</ul>
<a name="createMessage--">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>createMessage</h4>
<pre><a href="../../javax/jms/Message.html" title="interface in javax.jms">Message</a>&nbsp;createMessage()</pre>
<div class="block">Creates a <code>Message</code> object. The <code>Message</code> interface is the root interface of all JMS messages. A
<code>Message</code> object holds all the standard message header information. It can be sent when a message containing
only header information is sufficient.
<p>
The message object returned may be sent using any <code>Session</code> or <code>JMSContext</code>. It is not restricted to
being sent using the <code>JMSContext</code> used to create it.
<p>
The message object returned may be optimised for use with the JMS provider used to create it. However it can be sent
using any JMS provider, not just the JMS provider used to create it.</div>
<dl>
<dt><span class="returnLabel">Returns:</span></dt>
<dd>The created <code>Message</code> object.</dd>
<dt><span class="throwsLabel">Throws:</span></dt>
<dd><code><a href="../../javax/jms/JMSRuntimeException.html" title="class in javax.jms">JMSRuntimeException</a></code> - if the JMS provider fails to create this message due to some internal error.</dd>
</dl>
</li>
</ul>
<a name="createObjectMessage--">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>createObjectMessage</h4>
<pre><a href="../../javax/jms/ObjectMessage.html" title="interface in javax.jms">ObjectMessage</a>&nbsp;createObjectMessage()</pre>
<div class="block">Creates an <code>ObjectMessage</code> object. An <code>ObjectMessage</code> object is used to send a message that contains a
serializable Java object.
<p>
The message object returned may be sent using any <code>Session</code> or <code>JMSContext</code>. It is not restricted to
being sent using the <code>JMSContext</code> used to create it.
<p>
The message object returned may be optimised for use with the JMS provider used to create it. However it can be sent
using any JMS provider, not just the JMS provider used to create it.</div>
<dl>
<dt><span class="returnLabel">Returns:</span></dt>
<dd>The created <code>ObjectMessage</code> object.</dd>
<dt><span class="throwsLabel">Throws:</span></dt>
<dd><code><a href="../../javax/jms/JMSRuntimeException.html" title="class in javax.jms">JMSRuntimeException</a></code> - if the JMS provider fails to create this message due to some internal error.</dd>
</dl>
</li>
</ul>
<a name="createObjectMessage-java.io.Serializable-">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>createObjectMessage</h4>
<pre><a href="../../javax/jms/ObjectMessage.html" title="interface in javax.jms">ObjectMessage</a>&nbsp;createObjectMessage(java.io.Serializable&nbsp;object)</pre>
<div class="block">Creates an initialized <code>ObjectMessage</code> object. An <code>ObjectMessage</code> object is used to send a message that
contains a serializable Java object.
<p>
The message object returned may be sent using any <code>Session</code> or <code>JMSContext</code>. It is not restricted to
being sent using the <code>JMSContext</code> used to create it.
<p>
The message object returned may be optimised for use with the JMS provider used to create it. However it can be sent
using any JMS provider, not just the JMS provider used to create it.</div>
<dl>
<dt><span class="paramLabel">Parameters:</span></dt>
<dd><code>object</code> - the object to use to initialize this message</dd>
<dt><span class="returnLabel">Returns:</span></dt>
<dd>The created <code>ObjectMessage</code> object.</dd>
<dt><span class="throwsLabel">Throws:</span></dt>
<dd><code><a href="../../javax/jms/JMSRuntimeException.html" title="class in javax.jms">JMSRuntimeException</a></code> - if the JMS provider fails to create this message due to some internal error.</dd>
</dl>
</li>
</ul>
<a name="createStreamMessage--">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>createStreamMessage</h4>
<pre><a href="../../javax/jms/StreamMessage.html" title="interface in javax.jms">StreamMessage</a>&nbsp;createStreamMessage()</pre>
<div class="block">Creates a <code>StreamMessage</code> object. A <code>StreamMessage</code> object is used to send a self-defining stream of
primitive values in the Java programming language.
<p>
The message object returned may be sent using any <code>Session</code> or <code>JMSContext</code>. It is not restricted to
being sent using the <code>JMSContext</code> used to create it.
<p>
The message object returned may be optimised for use with the JMS provider used to create it. However it can be sent
using any JMS provider, not just the JMS provider used to create it.</div>
<dl>
<dt><span class="returnLabel">Returns:</span></dt>
<dd>The created <code>StreamMessage</code> object.</dd>
<dt><span class="throwsLabel">Throws:</span></dt>
<dd><code><a href="../../javax/jms/JMSRuntimeException.html" title="class in javax.jms">JMSRuntimeException</a></code> - if the JMS provider fails to create this message due to some internal error.</dd>
</dl>
</li>
</ul>
<a name="createTextMessage--">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>createTextMessage</h4>
<pre><a href="../../javax/jms/TextMessage.html" title="interface in javax.jms">TextMessage</a>&nbsp;createTextMessage()</pre>
<div class="block">Creates a <code>TextMessage</code> object. A <code>TextMessage</code> object is used to send a message containing a
<code>String</code> object.
<p>
The message object returned may be sent using any <code>Session</code> or <code>JMSContext</code>. It is not restricted to
being sent using the <code>JMSContext</code> used to create it.
<p>
The message object returned may be optimised for use with the JMS provider used to create it. However it can be sent
using any JMS provider, not just the JMS provider used to create it.</div>
<dl>
<dt><span class="returnLabel">Returns:</span></dt>
<dd>The created <code>TextMessage</code> object.</dd>
<dt><span class="throwsLabel">Throws:</span></dt>
<dd><code><a href="../../javax/jms/JMSRuntimeException.html" title="class in javax.jms">JMSRuntimeException</a></code> - if the JMS provider fails to create this message due to some internal error.</dd>
</dl>
</li>
</ul>
<a name="createTextMessage-java.lang.String-">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>createTextMessage</h4>
<pre><a href="../../javax/jms/TextMessage.html" title="interface in javax.jms">TextMessage</a>&nbsp;createTextMessage(java.lang.String&nbsp;text)</pre>
<div class="block">Creates an initialized <code>TextMessage</code> object. A <code>TextMessage</code> object is used to send a message containing
a <code>String</code>.
<p>
The message object returned may be sent using any <code>Session</code> or <code>JMSContext</code>. It is not restricted to
being sent using the <code>JMSContext</code> used to create it.
<p>
The message object returned may be optimised for use with the JMS provider used to create it. However it can be sent
using any JMS provider, not just the JMS provider used to create it.</div>
<dl>
<dt><span class="paramLabel">Parameters:</span></dt>
<dd><code>text</code> - the string used to initialize this message</dd>
<dt><span class="returnLabel">Returns:</span></dt>
<dd>The created <code>TextMessage</code> object.</dd>
<dt><span class="throwsLabel">Throws:</span></dt>
<dd><code><a href="../../javax/jms/JMSRuntimeException.html" title="class in javax.jms">JMSRuntimeException</a></code> - if the JMS provider fails to create this message due to some internal error.</dd>
</dl>
</li>
</ul>
<a name="getTransacted--">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>getTransacted</h4>
<pre>boolean&nbsp;getTransacted()</pre>
<div class="block">Indicates whether the JMSContext's session is in transacted mode.</div>
<dl>
<dt><span class="returnLabel">Returns:</span></dt>
<dd>true if the session is in transacted mode</dd>
<dt><span class="throwsLabel">Throws:</span></dt>
<dd><code><a href="../../javax/jms/JMSRuntimeException.html" title="class in javax.jms">JMSRuntimeException</a></code> - if the JMS provider fails to return the transaction mode due to some internal error.</dd>
</dl>
</li>
</ul>
<a name="getSessionMode--">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>getSessionMode</h4>
<pre>int&nbsp;getSessionMode()</pre>
<div class="block">Returns the session mode of the JMSContext's session. This can be set at the time that the JMSContext is created.
Possible values are JMSContext.SESSION_TRANSACTED, JMSContext.AUTO_ACKNOWLEDGE, JMSContext.CLIENT_ACKNOWLEDGE and
JMSContext.DUPS_OK_ACKNOWLEDGE
<p>
If a session mode was not specified when the JMSContext was created a value of JMSContext.AUTO_ACKNOWLEDGE will be
returned.</div>
<dl>
<dt><span class="returnLabel">Returns:</span></dt>
<dd>the session mode of the JMSContext's session</dd>
<dt><span class="throwsLabel">Throws:</span></dt>
<dd><code><a href="../../javax/jms/JMSRuntimeException.html" title="class in javax.jms">JMSRuntimeException</a></code> - if the JMS provider fails to return the acknowledgment mode due to some internal
error.</dd>
<dt><span class="simpleTagLabel">Since:</span></dt>
<dd>JMS 2.0</dd>
<dt><span class="seeLabel">See Also:</span></dt>
<dd><a href="../../javax/jms/Connection.html#createSession-boolean-int-"><code>Connection.createSession(boolean, int)</code></a></dd>
</dl>
</li>
</ul>
<a name="commit--">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>commit</h4>
<pre>void&nbsp;commit()</pre>
<div class="block">Commits all messages done in this transaction and releases any locks currently held.
<p>
This method must not return until any incomplete asynchronous send operations for this <tt>JMSContext</tt> have been
completed and any <tt>CompletionListener</tt> callbacks have returned. Incomplete sends should be allowed to complete
normally unless an error occurs.
<p>
A <tt>CompletionListener</tt> callback method must not call <tt>commit</tt> on its own <tt>JMSContext</tt>. Doing so
will cause an <tt>IllegalStateRuntimeException</tt> to be thrown.
<p>
This method must not be used if the <code>JMSContext</code> is container-managed (injected). Doing so will cause a
<code>IllegalStateRuntimeException</code> to be thrown.</div>
<dl>
<dt><span class="throwsLabel">Throws:</span></dt>
<dd><code><a href="../../javax/jms/IllegalStateRuntimeException.html" title="class in javax.jms">IllegalStateRuntimeException</a></code> - <ul>
<li>if the <tt>JMSContext</tt>'s session is not using a local transaction
<li>if this method has been called by a <tt>
CompletionListener</tt> callback method on its own <tt>
JMSContext</tt></li>
<li>if the <code>JMSContext</code> is container-managed (injected)
</ul></dd>
<dd><code><a href="../../javax/jms/TransactionRolledBackRuntimeException.html" title="class in javax.jms">TransactionRolledBackRuntimeException</a></code> - if the transaction is rolled back due to some internal error during
commit.</dd>
<dd><code><a href="../../javax/jms/JMSRuntimeException.html" title="class in javax.jms">JMSRuntimeException</a></code> - if the JMS provider fails to commit the transaction due to some internal error</dd>
</dl>
</li>
</ul>
<a name="rollback--">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>rollback</h4>
<pre>void&nbsp;rollback()</pre>
<div class="block">Rolls back any messages done in this transaction and releases any locks currently held.
<p>
This method must not return until any incomplete asynchronous send operations for this <tt>JMSContext</tt> have been
completed and any <tt>CompletionListener</tt> callbacks have returned. Incomplete sends should be allowed to complete
normally unless an error occurs.
<p>
A <tt>CompletionListener</tt> callback method must not call <tt>rollback</tt> on its own <tt>JMSContext</tt>. Doing
so will cause an <tt>IllegalStateRuntimeException</tt> to be thrown.
<p>
This method must not be used if the <code>JMSContext</code> is container-managed (injected). Doing so will cause a
<code>IllegalStateRuntimeException</code> to be thrown.</div>
<dl>
<dt><span class="throwsLabel">Throws:</span></dt>
<dd><code><a href="../../javax/jms/IllegalStateRuntimeException.html" title="class in javax.jms">IllegalStateRuntimeException</a></code> - <ul>
<li>if the <tt>JMSContext</tt>'s session is not using a local transaction
<li>if this method has been called by a <tt>CompletionListener</tt> callback method on its own
<tt>JMSContext</tt></li>
<li>if the <code>JMSContext</code> is container-managed (injected)
</ul></dd>
<dd><code><a href="../../javax/jms/JMSRuntimeException.html" title="class in javax.jms">JMSRuntimeException</a></code> - if the JMS provider fails to roll back the transaction due to some internal error</dd>
</dl>
</li>
</ul>
<a name="recover--">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>recover</h4>
<pre>void&nbsp;recover()</pre>
<div class="block">Stops message delivery in the JMSContext's session, and restarts message delivery with the oldest unacknowledged
message.
<p>
All consumers deliver messages in a serial order. Acknowledging a received message automatically acknowledges all
messages that have been delivered to the client.
<p>
Restarting a session causes it to take the following actions:
<ul>
<li>Stop message delivery
<li>Mark all messages that might have been delivered but not acknowledged as "redelivered"
<li>Restart the delivery sequence including all unacknowledged messages that had been previously delivered.
Redelivered messages do not have to be delivered in exactly their original delivery order.
</ul>
<p>
This method must not be used if the <code>JMSContext</code> is container-managed (injected). Doing so will cause a
<code>IllegalStateRuntimeException</code> to be thrown.</div>
<dl>
<dt><span class="throwsLabel">Throws:</span></dt>
<dd><code><a href="../../javax/jms/IllegalStateRuntimeException.html" title="class in javax.jms">IllegalStateRuntimeException</a></code> - <ul>
<li>if the <tt>JMSContext</tt>'s session is using a transaction
<li>if the <code>JMSContext</code> is container-managed (injected)
</ul></dd>
<dd><code><a href="../../javax/jms/JMSRuntimeException.html" title="class in javax.jms">JMSRuntimeException</a></code> - if the JMS provider fails to stop and restart message delivery due to some internal
error</dd>
</dl>
</li>
</ul>
<a name="createConsumer-javax.jms.Destination-">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>createConsumer</h4>
<pre><a href="../../javax/jms/JMSConsumer.html" title="interface in javax.jms">JMSConsumer</a>&nbsp;createConsumer(<a href="../../javax/jms/Destination.html" title="interface in javax.jms">Destination</a>&nbsp;destination)</pre>
<div class="block">Creates a <code>JMSConsumer</code> for the specified destination.
<p>
A client uses a <code>JMSConsumer</code> object to receive messages that have been sent to a destination.</div>
<dl>
<dt><span class="paramLabel">Parameters:</span></dt>
<dd><code>destination</code> - the <code>Destination</code> to access.</dd>
<dt><span class="returnLabel">Returns:</span></dt>
<dd>The created <code>JMSConsumer</code> object.</dd>
<dt><span class="throwsLabel">Throws:</span></dt>
<dd><code><a href="../../javax/jms/JMSRuntimeException.html" title="class in javax.jms">JMSRuntimeException</a></code> - if the session fails to create a <code>JMSConsumer</code> due to some internal error.</dd>
<dd><code><a href="../../javax/jms/InvalidDestinationRuntimeException.html" title="class in javax.jms">InvalidDestinationRuntimeException</a></code> - if an invalid destination is specified.</dd>
</dl>
</li>
</ul>
<a name="createConsumer-javax.jms.Destination-java.lang.String-">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>createConsumer</h4>
<pre><a href="../../javax/jms/JMSConsumer.html" title="interface in javax.jms">JMSConsumer</a>&nbsp;createConsumer(<a href="../../javax/jms/Destination.html" title="interface in javax.jms">Destination</a>&nbsp;destination,
java.lang.String&nbsp;messageSelector)</pre>
<div class="block">Creates a <code>JMSConsumer</code> for the specified destination, using a message selector.
<p>
A client uses a <code>JMSConsumer</code> object to receive messages that have been sent to a destination.</div>
<dl>
<dt><span class="paramLabel">Parameters:</span></dt>
<dd><code>destination</code> - the <code>Destination</code> to access</dd>
<dd><code>messageSelector</code> - only messages with properties matching the message selector expression are delivered. A value
of null or an empty string indicates that there is no message selector for the <code>JMSConsumer</code>.</dd>
<dt><span class="returnLabel">Returns:</span></dt>
<dd>The created <code>JMSConsumer</code> object.</dd>
<dt><span class="throwsLabel">Throws:</span></dt>
<dd><code><a href="../../javax/jms/JMSRuntimeException.html" title="class in javax.jms">JMSRuntimeException</a></code> - if the session fails to create a <code>JMSConsumer</code> due to some internal error.</dd>
<dd><code><a href="../../javax/jms/InvalidDestinationRuntimeException.html" title="class in javax.jms">InvalidDestinationRuntimeException</a></code> - if an invalid destination is specified.</dd>
<dd><code><a href="../../javax/jms/InvalidSelectorRuntimeException.html" title="class in javax.jms">InvalidSelectorRuntimeException</a></code> - if the message selector is invalid.</dd>
</dl>
</li>
</ul>
<a name="createConsumer-javax.jms.Destination-java.lang.String-boolean-">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>createConsumer</h4>
<pre><a href="../../javax/jms/JMSConsumer.html" title="interface in javax.jms">JMSConsumer</a>&nbsp;createConsumer(<a href="../../javax/jms/Destination.html" title="interface in javax.jms">Destination</a>&nbsp;destination,
java.lang.String&nbsp;messageSelector,
boolean&nbsp;noLocal)</pre>
<div class="block">Creates a <code>JMSConsumer</code> for the specified destination, specifying a message selector and the <code>noLocal</code>
parameter.
<p>
A client uses a <code>JMSConsumer</code> object to receive messages that have been sent to a destination.
<p>
The <code>noLocal</code> argument is for use when the destination is a topic and the JMSContext's connection is also being
used to publish messages to that topic. If <code>noLocal</code> is set to true then the <code>JMSConsumer</code> will not
receive messages published to the topic by its own connection. The default value of this argument is false. If the
destination is a queue then the effect of setting <code>noLocal</code> to true is not specified.</div>
<dl>
<dt><span class="paramLabel">Parameters:</span></dt>
<dd><code>destination</code> - the <code>Destination</code> to access</dd>
<dd><code>messageSelector</code> - only messages with properties matching the message selector expression are delivered. A value
of null or an empty string indicates that there is no message selector for the <code>JMSConsumer</code>.</dd>
<dd><code>noLocal</code> - if true, and the destination is a topic, then the <code>JMSConsumer</code> will not receive messages
published to the topic by its own connection</dd>
<dt><span class="returnLabel">Returns:</span></dt>
<dd>The created <code>JMSConsumer</code> object.</dd>
<dt><span class="throwsLabel">Throws:</span></dt>
<dd><code><a href="../../javax/jms/JMSRuntimeException.html" title="class in javax.jms">JMSRuntimeException</a></code> - if the session fails to create a <code>JMSConsumer</code> due to some internal error.</dd>
<dd><code><a href="../../javax/jms/InvalidDestinationRuntimeException.html" title="class in javax.jms">InvalidDestinationRuntimeException</a></code> - if an invalid destination is specified.</dd>
<dd><code><a href="../../javax/jms/InvalidSelectorRuntimeException.html" title="class in javax.jms">InvalidSelectorRuntimeException</a></code> - if the message selector is invalid.</dd>
</dl>
</li>
</ul>
<a name="createQueue-java.lang.String-">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>createQueue</h4>
<pre><a href="../../javax/jms/Queue.html" title="interface in javax.jms">Queue</a>&nbsp;createQueue(java.lang.String&nbsp;queueName)</pre>
<div class="block">Creates a <code>Queue</code> object which encapsulates a specified provider-specific queue name.
<p>
The use of provider-specific queue names in an application may render the application non-portable. Portable
applications are recommended to not use this method but instead look up an administratively-defined <code>Queue</code>
object using JNDI.
<p>
Note that this method simply creates an object that encapsulates the name of a queue. It does not create the physical
queue in the JMS provider. JMS does not provide a method to create the physical queue, since this would be specific
to a given JMS provider. Creating a physical queue is provider-specific and is typically an administrative task
performed by an administrator, though some providers may create them automatically when needed. The one exception to
this is the creation of a temporary queue, which is done using the <code>createTemporaryQueue</code> method.</div>
<dl>
<dt><span class="paramLabel">Parameters:</span></dt>
<dd><code>queueName</code> - A provider-specific queue name</dd>
<dt><span class="returnLabel">Returns:</span></dt>
<dd>a Queue object which encapsulates the specified name</dd>
<dt><span class="throwsLabel">Throws:</span></dt>
<dd><code><a href="../../javax/jms/JMSRuntimeException.html" title="class in javax.jms">JMSRuntimeException</a></code> - if a Queue object cannot be created due to some internal error</dd>
</dl>
</li>
</ul>
<a name="createTopic-java.lang.String-">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>createTopic</h4>
<pre><a href="../../javax/jms/Topic.html" title="interface in javax.jms">Topic</a>&nbsp;createTopic(java.lang.String&nbsp;topicName)</pre>
<div class="block">Creates a <code>Topic</code> object which encapsulates a specified provider-specific topic name.
<p>
The use of provider-specific topic names in an application may render the application non-portable. Portable
applications are recommended to not use this method but instead look up an administratively-defined <code>Topic</code>
object using JNDI.
<p>
Note that this method simply creates an object that encapsulates the name of a topic. It does not create the physical
topic in the JMS provider. JMS does not provide a method to create the physical topic, since this would be specific
to a given JMS provider. Creating a physical topic is provider-specific and is typically an administrative task
performed by an administrator, though some providers may create them automatically when needed. The one exception to
this is the creation of a temporary topic, which is done using the <code>createTemporaryTopic</code> method.</div>
<dl>
<dt><span class="paramLabel">Parameters:</span></dt>
<dd><code>topicName</code> - A provider-specific topic name</dd>
<dt><span class="returnLabel">Returns:</span></dt>
<dd>a Topic object which encapsulates the specified name</dd>
<dt><span class="throwsLabel">Throws:</span></dt>
<dd><code><a href="../../javax/jms/JMSRuntimeException.html" title="class in javax.jms">JMSRuntimeException</a></code> - if a Topic object cannot be created due to some internal error</dd>
</dl>
</li>
</ul>
<a name="createDurableConsumer-javax.jms.Topic-java.lang.String-">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>createDurableConsumer</h4>
<pre><a href="../../javax/jms/JMSConsumer.html" title="interface in javax.jms">JMSConsumer</a>&nbsp;createDurableConsumer(<a href="../../javax/jms/Topic.html" title="interface in javax.jms">Topic</a>&nbsp;topic,
java.lang.String&nbsp;name)</pre>
<div class="block">Creates an unshared durable subscription on the specified topic (if one does not already exist) and creates a
consumer on that durable subscription. This method creates the durable subscription without a message selector and
with a <code>noLocal</code> value of <code>false</code>.
<p>
A durable subscription is used by an application which needs to receive all the messages published on a topic,
including the ones published when there is no active consumer associated with it. The JMS provider retains a record
of this durable subscription and ensures that all messages from the topic's publishers are retained until they are
delivered to, and acknowledged by, a consumer on this durable subscription or until they have expired.
<p>
A durable subscription will continue to accumulate messages until it is deleted using the <code>unsubscribe</code> method.
<p>
This method may only be used with unshared durable subscriptions. Any durable subscription created using this method
will be unshared. This means that only one active (i.e. not closed) consumer on the subscription may exist at a time.
The term "consumer" here means a <code>TopicSubscriber</code>, <code>MessageConsumer</code> or <code>JMSConsumer</code> object in
any client.
<p>
An unshared durable subscription is identified by a name specified by the client and by the client identifier, which
must be set. An application which subsequently wishes to create a consumer on that unshared durable subscription must
use the same client identifier.
<p>
If an unshared durable subscription already exists with the same name and client identifier, and the same topic,
message selector and <code>noLocal</code> value has been specified, and there is no consumer already active (i.e. not
closed) on the durable subscription then this method creates a <code>JMSConsumer</code> on the existing durable
subscription.
<p>
If an unshared durable subscription already exists with the same name and client identifier, and there is a consumer
already active (i.e. not closed) on the durable subscription, then a <code>JMSRuntimeException</code> will be thrown.
<p>
If an unshared durable subscription already exists with the same name and client identifier but a different topic,
message selector or <code>noLocal</code> value has been specified, and there is no consumer already active (i.e. not
closed) on the durable subscription then this is equivalent to unsubscribing (deleting) the old one and creating a
new one.
<p>
A shared durable subscription and an unshared durable subscription may not have the same name and client identifier.
If a shared durable subscription already exists with the same name and client identifier then a
<code>JMSRuntimeException</code> is thrown.
<p>
There is no restriction on durable subscriptions and shared non-durable subscriptions having the same name and
clientId. Such subscriptions would be completely separate.</div>
<dl>
<dt><span class="paramLabel">Parameters:</span></dt>
<dd><code>topic</code> - the non-temporary <code>Topic</code> to subscribe to</dd>
<dd><code>name</code> - the name used to identify this subscription</dd>
<dt><span class="returnLabel">Returns:</span></dt>
<dd>The created <code>JMSConsumer</code> object.</dd>
<dt><span class="throwsLabel">Throws:</span></dt>
<dd><code><a href="../../javax/jms/InvalidDestinationRuntimeException.html" title="class in javax.jms">InvalidDestinationRuntimeException</a></code> - if an invalid topic is specified.</dd>
<dd><code><a href="../../javax/jms/IllegalStateRuntimeException.html" title="class in javax.jms">IllegalStateRuntimeException</a></code> - if the client identifier is unset</dd>
<dd><code><a href="../../javax/jms/JMSRuntimeException.html" title="class in javax.jms">JMSRuntimeException</a></code> - <ul>
<li>if the session fails to create the non-shared durable subscription and <code>JMSConsumer</code> due to some internal
error
<li>if an unshared durable subscription already exists with the same name and client identifier, and there is a
consumer already active
<li>if a shared durable subscription already exists with the same name and client identifier
</ul></dd>
<dt><span class="simpleTagLabel">Since:</span></dt>
<dd>JMS 2.0</dd>
</dl>
</li>
</ul>
<a name="createDurableConsumer-javax.jms.Topic-java.lang.String-java.lang.String-boolean-">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>createDurableConsumer</h4>
<pre><a href="../../javax/jms/JMSConsumer.html" title="interface in javax.jms">JMSConsumer</a>&nbsp;createDurableConsumer(<a href="../../javax/jms/Topic.html" title="interface in javax.jms">Topic</a>&nbsp;topic,
java.lang.String&nbsp;name,
java.lang.String&nbsp;messageSelector,
boolean&nbsp;noLocal)</pre>
<div class="block">Creates an unshared durable subscription on the specified topic (if one does not already exist), specifying a message
selector and the <code>noLocal</code> parameter, and creates a consumer on that durable subscription.
<p>
A durable subscription is used by an application which needs to receive all the messages published on a topic,
including the ones published when there is no active consumer associated with it. The JMS provider retains a record
of this durable subscription and ensures that all messages from the topic's publishers are retained until they are
delivered to, and acknowledged by, a consumer on this durable subscription or until they have expired.
<p>
A durable subscription will continue to accumulate messages until it is deleted using the <code>unsubscribe</code> method.
<p>
This method may only be used with unshared durable subscriptions. Any durable subscription created using this method
will be unshared. This means that only one active (i.e. not closed) consumer on the subscription may exist at a time.
The term "consumer" here means a <code>TopicSubscriber</code>, <code>MessageConsumer</code> or <code>JMSConsumer</code> object in
any client.
<p>
An unshared durable subscription is identified by a name specified by the client and by the client identifier, which
must be set. An application which subsequently wishes to create a consumer on that unshared durable subscription must
use the same client identifier.
<p>
If an unshared durable subscription already exists with the same name and client identifier, and the same topic,
message selector and <code>noLocal</code> value has been specified, and there is no consumer already active (i.e. not
closed) on the durable subscription then this method creates a <code>JMSConsumer</code> on the existing durable
subscription.
<p>
If an unshared durable subscription already exists with the same name and client identifier, and there is a consumer
already active (i.e. not closed) on the durable subscription, then a <code>JMSRuntimeException</code> will be thrown.
<p>
If an unshared durable subscription already exists with the same name and client identifier but a different topic,
message selector or <code>noLocal</code> value has been specified, and there is no consumer already active (i.e. not
closed) on the durable subscription then this is equivalent to unsubscribing (deleting) the old one and creating a
new one.
<p>
If <code>noLocal</code> is set to true then any messages published to the topic using this <code>JMSContext</code>'s
connection, or any other connection with the same client identifier, will not be added to the durable subscription.
<p>
A shared durable subscription and an unshared durable subscription may not have the same name and client identifier.
If a shared durable subscription already exists with the same name and client identifier then a
<code>JMSRuntimeException</code> is thrown.
<p>
There is no restriction on durable subscriptions and shared non-durable subscriptions having the same name and
clientId. Such subscriptions would be completely separate.
<p>
This method is identical to the corresponding <code>createDurableSubscriber</code> method except that it returns a
<code>MessageConsumer</code> rather than a <code>TopicSubscriber</code> to represent the consumer.</div>
<dl>
<dt><span class="paramLabel">Parameters:</span></dt>
<dd><code>topic</code> - the non-temporary <code>Topic</code> to subscribe to</dd>
<dd><code>name</code> - the name used to identify this subscription</dd>
<dd><code>messageSelector</code> - only messages with properties matching the message selector expression are added to the
durable subscription. A value of null or an empty string indicates that there is no message selector for the durable
subscription.</dd>
<dd><code>noLocal</code> - if true then any messages published to the topic using this session's connection, or any other
connection with the same client identifier, will not be added to the durable subscription.</dd>
<dt><span class="returnLabel">Returns:</span></dt>
<dd>The created <code>JMSConsumer</code> object.</dd>
<dt><span class="throwsLabel">Throws:</span></dt>
<dd><code><a href="../../javax/jms/InvalidDestinationRuntimeException.html" title="class in javax.jms">InvalidDestinationRuntimeException</a></code> - if an invalid topic is specified.</dd>
<dd><code><a href="../../javax/jms/InvalidSelectorRuntimeException.html" title="class in javax.jms">InvalidSelectorRuntimeException</a></code> - if the message selector is invalid.</dd>
<dd><code><a href="../../javax/jms/IllegalStateRuntimeException.html" title="class in javax.jms">IllegalStateRuntimeException</a></code> - if the client identifier is unset</dd>
<dd><code><a href="../../javax/jms/JMSRuntimeException.html" title="class in javax.jms">JMSRuntimeException</a></code> - <ul>
<li>if the session fails to create the non-shared durable subscription and <code>JMSConsumer</code> due to some internal
error
<li>if an unshared durable subscription already exists with the same name and client identifier, and there is a
consumer already active
<li>if a shared durable subscription already exists with the same name and client identifier
</ul></dd>
<dt><span class="simpleTagLabel">Since:</span></dt>
<dd>JMS 2.0</dd>
</dl>
</li>
</ul>
<a name="createSharedDurableConsumer-javax.jms.Topic-java.lang.String-">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>createSharedDurableConsumer</h4>
<pre><a href="../../javax/jms/JMSConsumer.html" title="interface in javax.jms">JMSConsumer</a>&nbsp;createSharedDurableConsumer(<a href="../../javax/jms/Topic.html" title="interface in javax.jms">Topic</a>&nbsp;topic,
java.lang.String&nbsp;name)</pre>
<div class="block">Creates a shared durable subscription on the specified topic (if one does not already exist), specifying a message
selector, and creates a consumer on that durable subscription. This method creates the durable subscription without a
message selector.
<p>
A durable subscription is used by an application which needs to receive all the messages published on a topic,
including the ones published when there is no active consumer associated with it. The JMS provider retains a record
of this durable subscription and ensures that all messages from the topic's publishers are retained until they are
delivered to, and acknowledged by, a consumer on this durable subscription or until they have expired.
<p>
A durable subscription will continue to accumulate messages until it is deleted using the <code>unsubscribe</code> method.
<p>
This method may only be used with shared durable subscriptions. Any durable subscription created using this method
will be shared. This means that multiple active (i.e. not closed) consumers on the subscription may exist at the same
time. The term "consumer" here means a <code>MessageConsumer</code> or <code>JMSConsumer</code> object in any client.
<p>
A shared durable subscription is identified by a name specified by the client and by the client identifier (which may
be unset). An application which subsequently wishes to create a consumer on that shared durable subscription must use
the same client identifier.
<p>
If a shared durable subscription already exists with the same name and client identifier (if set), and the same topic
and message selector has been specified, then this method creates a <code>JMSConsumer</code> on the existing shared
durable subscription.
<p>
If a shared durable subscription already exists with the same name and client identifier (if set) but a different
topic or message selector has been specified, and there is no consumer already active (i.e. not closed) on the
durable subscription then this is equivalent to unsubscribing (deleting) the old one and creating a new one.
<p>
If a shared durable subscription already exists with the same name and client identifier (if set) but a different
topic or message selector has been specified, and there is a consumer already active (i.e. not closed) on the durable
subscription, then a <code>JMSRuntimeException</code> will be thrown.
<p>
A shared durable subscription and an unshared durable subscription may not have the same name and client identifier
(if set). If an unshared durable subscription already exists with the same name and client identifier (if set) then a
<code>JMSRuntimeException</code> is thrown.
<p>
If a message selector is specified then only messages with properties matching the message selector expression will
be added to the subscription.
<p>
There is no restriction on durable subscriptions and shared non-durable subscriptions having the same name and
clientId (which may be unset). Such subscriptions would be completely separate.</div>
<dl>
<dt><span class="paramLabel">Parameters:</span></dt>
<dd><code>topic</code> - the non-temporary <code>Topic</code> to subscribe to</dd>
<dd><code>name</code> - the name used to identify this subscription</dd>
<dt><span class="returnLabel">Returns:</span></dt>
<dd>The created <code>JMSConsumer</code> object.</dd>
<dt><span class="throwsLabel">Throws:</span></dt>
<dd><code><a href="../../javax/jms/InvalidDestinationRuntimeException.html" title="class in javax.jms">InvalidDestinationRuntimeException</a></code> - if an invalid topic is specified.</dd>
<dd><code><a href="../../javax/jms/JMSRuntimeException.html" title="class in javax.jms">JMSRuntimeException</a></code> - <ul>
<li>if the session fails to create the shared durable subscription and <code>MessageConsumer</code> due to some internal
error
<li>if a shared durable subscription already exists with the same name and client identifier, but a different topic,
or message selector, and there is a consumer already active
<li>if an unshared durable subscription already exists with the same name and client identifier
</ul></dd>
<dt><span class="simpleTagLabel">Since:</span></dt>
<dd>JMS 2.0</dd>
</dl>
</li>
</ul>
<a name="createSharedDurableConsumer-javax.jms.Topic-java.lang.String-java.lang.String-">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>createSharedDurableConsumer</h4>
<pre><a href="../../javax/jms/JMSConsumer.html" title="interface in javax.jms">JMSConsumer</a>&nbsp;createSharedDurableConsumer(<a href="../../javax/jms/Topic.html" title="interface in javax.jms">Topic</a>&nbsp;topic,
java.lang.String&nbsp;name,
java.lang.String&nbsp;messageSelector)</pre>
<div class="block">Creates a shared durable subscription on the specified topic (if one does not already exist), specifying a message
selector, and creates a consumer on that durable subscription.
<p>
A durable subscription is used by an application which needs to receive all the messages published on a topic,
including the ones published when there is no active consumer associated with it. The JMS provider retains a record
of this durable subscription and ensures that all messages from the topic's publishers are retained until they are
delivered to, and acknowledged by, a consumer on this durable subscription or until they have expired.
<p>
A durable subscription will continue to accumulate messages until it is deleted using the <code>unsubscribe</code> method.
<p>
This method may only be used with shared durable subscriptions. Any durable subscription created using this method
will be shared. This means that multiple active (i.e. not closed) consumers on the subscription may exist at the same
time. The term "consumer" here means a <code>MessageConsumer</code> or <code>JMSConsumer</code> object in any client.
<p>
A shared durable subscription is identified by a name specified by the client and by the client identifier (which may
be unset). An application which subsequently wishes to create a consumer on that shared durable subscription must use
the same client identifier.
<p>
If a shared durable subscription already exists with the same name and client identifier (if set), and the same topic
and message selector have been specified, then this method creates a <code>JMSConsumer</code> on the existing shared
durable subscription.
<p>
If a shared durable subscription already exists with the same name and client identifier (if set), but a different
topic or message selector has been specified, and there is no consumer already active (i.e. not closed) on the
durable subscription then this is equivalent to unsubscribing (deleting) the old one and creating a new one.
<p>
If a shared durable subscription already exists with the same name and client identifier (if set) but a different
topic or message selector has been specified, and there is a consumer already active (i.e. not closed) on the durable
subscription, then a <code>JMSRuntimeException</code> will be thrown.
<p>
A shared durable subscription and an unshared durable subscription may not have the same name and client identifier
(if set). If an unshared durable subscription already exists with the same name and client identifier (if set) then a
<code>JMSRuntimeException</code> is thrown.
<p>
There is no restriction on durable subscriptions and shared non-durable subscriptions having the same name and
clientId (which may be unset). Such subscriptions would be completely separate.</div>
<dl>
<dt><span class="paramLabel">Parameters:</span></dt>
<dd><code>topic</code> - the non-temporary <code>Topic</code> to subscribe to</dd>
<dd><code>name</code> - the name used to identify this subscription</dd>
<dd><code>messageSelector</code> - only messages with properties matching the message selector expression are added to the
durable subscription. A value of null or an empty string indicates that there is no message selector for the durable
subscription.</dd>
<dt><span class="returnLabel">Returns:</span></dt>
<dd>The created <code>JMSConsumer</code> object.</dd>
<dt><span class="throwsLabel">Throws:</span></dt>
<dd><code><a href="../../javax/jms/InvalidDestinationRuntimeException.html" title="class in javax.jms">InvalidDestinationRuntimeException</a></code> - if an invalid topic is specified.</dd>
<dd><code><a href="../../javax/jms/InvalidSelectorRuntimeException.html" title="class in javax.jms">InvalidSelectorRuntimeException</a></code> - if the message selector is invalid.</dd>
<dd><code><a href="../../javax/jms/JMSRuntimeException.html" title="class in javax.jms">JMSRuntimeException</a></code> - <ul>
<li>if the session fails to create the shared durable subscription and <code>JMSConsumer</code> due to some internal error
<li>if a shared durable subscription already exists with the same name and client identifier, but a different topic,
or message selector, and there is a consumer already active
<li>if an unshared durable subscription already exists with the same name and client identifier
</ul></dd>
<dt><span class="simpleTagLabel">Since:</span></dt>
<dd>JMS 2.0</dd>
</dl>
</li>
</ul>
<a name="createSharedConsumer-javax.jms.Topic-java.lang.String-">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>createSharedConsumer</h4>
<pre><a href="../../javax/jms/JMSConsumer.html" title="interface in javax.jms">JMSConsumer</a>&nbsp;createSharedConsumer(<a href="../../javax/jms/Topic.html" title="interface in javax.jms">Topic</a>&nbsp;topic,
java.lang.String&nbsp;sharedSubscriptionName)</pre>
<div class="block">Creates a shared non-durable subscription with the specified name on the specified topic (if one does not already
exist) and creates a consumer on that subscription. This method creates the non-durable subscription without a
message selector.
<p>
If a shared non-durable subscription already exists with the same name and client identifier (if set), and the same
topic and message selector has been specified, then this method creates a <code>JMSConsumer</code> on the existing
subscription.
<p>
A non-durable shared subscription is used by a client which needs to be able to share the work of receiving messages
from a topic subscription amongst multiple consumers. A non-durable shared subscription may therefore have more than
one consumer. Each message from the subscription will be delivered to only one of the consumers on that subscription.
Such a subscription is not persisted and will be deleted (together with any undelivered messages associated with it)
when there are no consumers on it. The term "consumer" here means a <code>MessageConsumer</code> or <code>JMSConsumer</code>
object in any client.
<p>
A shared non-durable subscription is identified by a name specified by the client and by the client identifier (which
may be unset). An application which subsequently wishes to create a consumer on that shared non-durable subscription
must use the same client identifier.
<p>
If a shared non-durable subscription already exists with the same name and client identifier (if set) but a different
topic or message selector value has been specified, and there is a consumer already active (i.e. not closed) on the
subscription, then a <code>JMSRuntimeException</code> will be thrown.
<p>
There is no restriction on durable subscriptions and shared non-durable subscriptions having the same name and
clientId (which may be unset). Such subscriptions would be completely separate.</div>
<dl>
<dt><span class="paramLabel">Parameters:</span></dt>
<dd><code>topic</code> - the <code>Topic</code> to subscribe to</dd>
<dd><code>sharedSubscriptionName</code> - the name used to identify the shared non-durable subscription</dd>
<dt><span class="returnLabel">Returns:</span></dt>
<dd>The created <code>JMSConsumer</code> object.</dd>
<dt><span class="throwsLabel">Throws:</span></dt>
<dd><code><a href="../../javax/jms/JMSRuntimeException.html" title="class in javax.jms">JMSRuntimeException</a></code> - if the session fails to create the shared non-durable subscription and <code>JMSContext</code>
due to some internal error.</dd>
<dd><code><a href="../../javax/jms/InvalidDestinationRuntimeException.html" title="class in javax.jms">InvalidDestinationRuntimeException</a></code> - if an invalid topic is specified.</dd>
<dd><code><a href="../../javax/jms/InvalidSelectorRuntimeException.html" title="class in javax.jms">InvalidSelectorRuntimeException</a></code> - if the message selector is invalid.</dd>
</dl>
</li>
</ul>
<a name="createSharedConsumer-javax.jms.Topic-java.lang.String-java.lang.String-">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>createSharedConsumer</h4>
<pre><a href="../../javax/jms/JMSConsumer.html" title="interface in javax.jms">JMSConsumer</a>&nbsp;createSharedConsumer(<a href="../../javax/jms/Topic.html" title="interface in javax.jms">Topic</a>&nbsp;topic,
java.lang.String&nbsp;sharedSubscriptionName,
java.lang.String&nbsp;messageSelector)</pre>
<div class="block">Creates a shared non-durable subscription with the specified name on the specified topic (if one does not already
exist) specifying a message selector, and creates a consumer on that subscription.
<p>
If a shared non-durable subscription already exists with the same name and client identifier (if set), and the same
topic and message selector has been specified, then this method creates a <code>JMSConsumer</code> on the existing
subscription.
<p>
A non-durable shared subscription is used by a client which needs to be able to share the work of receiving messages
from a topic subscription amongst multiple consumers. A non-durable shared subscription may therefore have more than
one consumer. Each message from the subscription will be delivered to only one of the consumers on that subscription.
Such a subscription is not persisted and will be deleted (together with any undelivered messages associated with it)
when there are no consumers on it. The term "consumer" here means a <code>MessageConsumer</code> or <code>JMSConsumer</code>
object in any client.
<p>
A shared non-durable subscription is identified by a name specified by the client and by the client identifier (which
may be unset). An application which subsequently wishes to create a consumer on that shared non-durable subscription
must use the same client identifier.
<p>
If a shared non-durable subscription already exists with the same name and client identifier (if set) but a different
topic or message selector has been specified, and there is a consumer already active (i.e. not closed) on the
subscription, then a <code>JMSRuntimeException</code> will be thrown.
<p>
There is no restriction on durable subscriptions and shared non-durable subscriptions having the same name and
clientId (which may be unset). Such subscriptions would be completely separate.</div>
<dl>
<dt><span class="paramLabel">Parameters:</span></dt>
<dd><code>topic</code> - the <code>Topic</code> to subscribe to</dd>
<dd><code>sharedSubscriptionName</code> - the name used to identify the shared non-durable subscription</dd>
<dd><code>messageSelector</code> - only messages with properties matching the message selector expression are added to the shared
non-durable subscription. A value of null or an empty string indicates that there is no message selector for the
shared non-durable subscription.</dd>
<dt><span class="returnLabel">Returns:</span></dt>
<dd>The created <code>JMSConsumer</code> object.</dd>
<dt><span class="throwsLabel">Throws:</span></dt>
<dd><code><a href="../../javax/jms/JMSRuntimeException.html" title="class in javax.jms">JMSRuntimeException</a></code> - if the session fails to create the shared non-durable subscription and
<code>JMSConsumer</code> due to some internal error.</dd>
<dd><code><a href="../../javax/jms/InvalidDestinationRuntimeException.html" title="class in javax.jms">InvalidDestinationRuntimeException</a></code> - if an invalid topic is specified.</dd>
<dd><code><a href="../../javax/jms/InvalidSelectorRuntimeException.html" title="class in javax.jms">InvalidSelectorRuntimeException</a></code> - if the message selector is invalid.</dd>
</dl>
</li>
</ul>
<a name="createBrowser-javax.jms.Queue-">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>createBrowser</h4>
<pre><a href="../../javax/jms/QueueBrowser.html" title="interface in javax.jms">QueueBrowser</a>&nbsp;createBrowser(<a href="../../javax/jms/Queue.html" title="interface in javax.jms">Queue</a>&nbsp;queue)</pre>
<div class="block">Creates a <code>QueueBrowser</code> object to peek at the messages on the specified queue.</div>
<dl>
<dt><span class="paramLabel">Parameters:</span></dt>
<dd><code>queue</code> - the <code>queue</code> to access</dd>
<dt><span class="returnLabel">Returns:</span></dt>
<dd>The created <code>QueueBrowser</code> object.</dd>
<dt><span class="throwsLabel">Throws:</span></dt>
<dd><code><a href="../../javax/jms/JMSRuntimeException.html" title="class in javax.jms">JMSRuntimeException</a></code> - if the session fails to create a browser due to some internal error.</dd>
<dd><code><a href="../../javax/jms/InvalidDestinationRuntimeException.html" title="class in javax.jms">InvalidDestinationRuntimeException</a></code> - if an invalid destination is specified</dd>
</dl>
</li>
</ul>
<a name="createBrowser-javax.jms.Queue-java.lang.String-">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>createBrowser</h4>
<pre><a href="../../javax/jms/QueueBrowser.html" title="interface in javax.jms">QueueBrowser</a>&nbsp;createBrowser(<a href="../../javax/jms/Queue.html" title="interface in javax.jms">Queue</a>&nbsp;queue,
java.lang.String&nbsp;messageSelector)</pre>
<div class="block">Creates a <code>QueueBrowser</code> object to peek at the messages on the specified queue using a message selector.</div>
<dl>
<dt><span class="paramLabel">Parameters:</span></dt>
<dd><code>queue</code> - the <code>queue</code> to access</dd>
<dd><code>messageSelector</code> - only messages with properties matching the message selector expression are delivered. A value
of null or an empty string indicates that there is no message selector for the message consumer.</dd>
<dt><span class="returnLabel">Returns:</span></dt>
<dd>The created <code>QueueBrowser</code> object.</dd>
<dt><span class="throwsLabel">Throws:</span></dt>
<dd><code><a href="../../javax/jms/JMSRuntimeException.html" title="class in javax.jms">JMSRuntimeException</a></code> - if the session fails to create a browser due to some internal error.</dd>
<dd><code><a href="../../javax/jms/InvalidDestinationRuntimeException.html" title="class in javax.jms">InvalidDestinationRuntimeException</a></code> - if an invalid destination is specified</dd>
<dd><code><a href="../../javax/jms/InvalidSelectorRuntimeException.html" title="class in javax.jms">InvalidSelectorRuntimeException</a></code> - if the message selector is invalid.</dd>
</dl>
</li>
</ul>
<a name="createTemporaryQueue--">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>createTemporaryQueue</h4>
<pre><a href="../../javax/jms/TemporaryQueue.html" title="interface in javax.jms">TemporaryQueue</a>&nbsp;createTemporaryQueue()</pre>
<div class="block">Creates a <code>TemporaryQueue</code> object. Its lifetime will be that of the JMSContext's <code>Connection</code> unless it
is deleted earlier.</div>
<dl>
<dt><span class="returnLabel">Returns:</span></dt>
<dd>a temporary queue identity</dd>
<dt><span class="throwsLabel">Throws:</span></dt>
<dd><code><a href="../../javax/jms/JMSRuntimeException.html" title="class in javax.jms">JMSRuntimeException</a></code> - if the session fails to create a temporary queue due to some internal error.</dd>
</dl>
</li>
</ul>
<a name="createTemporaryTopic--">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>createTemporaryTopic</h4>
<pre><a href="../../javax/jms/TemporaryTopic.html" title="interface in javax.jms">TemporaryTopic</a>&nbsp;createTemporaryTopic()</pre>
<div class="block">Creates a <code>TemporaryTopic</code> object. Its lifetime will be that of the JMSContext's <code>Connection</code> unless it
is deleted earlier.</div>
<dl>
<dt><span class="returnLabel">Returns:</span></dt>
<dd>a temporary topic identity</dd>
<dt><span class="throwsLabel">Throws:</span></dt>
<dd><code><a href="../../javax/jms/JMSRuntimeException.html" title="class in javax.jms">JMSRuntimeException</a></code> - if the session fails to create a temporary topic due to some internal error.</dd>
</dl>
</li>
</ul>
<a name="unsubscribe-java.lang.String-">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>unsubscribe</h4>
<pre>void&nbsp;unsubscribe(java.lang.String&nbsp;name)</pre>
<div class="block">Unsubscribes a durable subscription that has been created by a client.
<p>
This method deletes the state being maintained on behalf of the subscriber by its provider.
<p>
A durable subscription is identified by a name specified by the client and by the client identifier if set. If the
client identifier was set when the durable subscription was created then a client which subsequently wishes to use
this method to delete a durable subscription must use the same client identifier.
<p>
It is erroneous for a client to delete a durable subscription while there is an active (not closed) consumer on that
subscription, or while a consumed message is part of a pending transaction or has not been acknowledged in the
session.
<p>
If the active consumer is represented by a <code>JMSConsumer</code> then calling <code>close</code> on either that object or
the <code>JMSContext</code> used to create it will render the consumer inactive and allow the subscription to be deleted.
<p>
If the active consumer was created by calling <code>setMessageListener</code> on the <code>JMSContext</code> then calling
<code>close</code> on the <code>JMSContext</code> will render the consumer inactive and allow the subscription to be deleted.
<p>
If the active consumer is represented by a <code>MessageConsumer</code> or <code>TopicSubscriber</code> then calling
<code>close</code> on that object or on the <code>Session</code> or <code>Connection</code> used to create it will render the
consumer inactive and allow the subscription to be deleted.</div>
<dl>
<dt><span class="paramLabel">Parameters:</span></dt>
<dd><code>name</code> - the name used to identify this subscription</dd>
<dt><span class="throwsLabel">Throws:</span></dt>
<dd><code><a href="../../javax/jms/JMSRuntimeException.html" title="class in javax.jms">JMSRuntimeException</a></code> - if the session fails to unsubscribe to the durable subscription due to some internal
error.</dd>
<dd><code><a href="../../javax/jms/InvalidDestinationRuntimeException.html" title="class in javax.jms">InvalidDestinationRuntimeException</a></code> - if an invalid subscription name is specified.</dd>
</dl>
</li>
</ul>
<a name="acknowledge--">
<!-- -->
</a>
<ul class="blockListLast">
<li class="blockList">
<h4>acknowledge</h4>
<pre>void&nbsp;acknowledge()</pre>
<div class="block">Acknowledges all messages consumed by the JMSContext's session.
<p>
This method is for use when the session has an acknowledgement mode of CLIENT_ACKNOWLEDGE. If the session is
transacted or has an acknowledgement mode of AUTO_ACKNOWLEDGE or DUPS_OK_ACKNOWLEDGE calling this method has no
effect.
<p>
This method has identical behaviour to the <code>acknowledge</code> method on <code>Message</code>. A client may individually
acknowledge each message as it is consumed, or it may choose to acknowledge messages as an application-defined group.
In both cases it makes no difference which of these two methods is used.
<p>
Messages that have been received but not acknowledged may be redelivered.
<p>
This method must not be used if the <code>JMSContext</code> is container-managed (injected). Doing so will cause a
<code>IllegalStateRuntimeException</code> to be thrown.</div>
<dl>
<dt><span class="throwsLabel">Throws:</span></dt>
<dd><code><a href="../../javax/jms/IllegalStateRuntimeException.html" title="class in javax.jms">IllegalStateRuntimeException</a></code> - <ul>
<li>if the <code>JMSContext</code> is closed.
<li>if the <code>JMSContext</code> is container-managed (injected)
</ul></dd>
<dd><code><a href="../../javax/jms/JMSRuntimeException.html" title="class in javax.jms">JMSRuntimeException</a></code> - if the JMS provider fails to acknowledge the messages due to some internal error</dd>
<dt><span class="seeLabel">See Also:</span></dt>
<dd><a href="../../javax/jms/Session.html#CLIENT_ACKNOWLEDGE"><code>Session.CLIENT_ACKNOWLEDGE</code></a>,
<a href="../../javax/jms/Message.html#acknowledge--"><code>Message.acknowledge()</code></a></dd>
</dl>
</li>
</ul>
</li>
</ul>
</li>
</ul>
</div>
</div>
<!-- ========= END OF CLASS DATA ========= -->
<!-- ======= START OF BOTTOM NAVBAR ====== -->
<div class="bottomNav"><a name="navbar.bottom">
<!-- -->
</a>
<div class="skipNav"><a href="#skip.navbar.bottom" title="Skip navigation links">Skip navigation links</a></div>
<a name="navbar.bottom.firstrow">
<!-- -->
</a>
<ul class="navList" title="Navigation">
<li><a href="../../overview-summary.html">Overview</a></li>
<li><a href="package-summary.html">Package</a></li>
<li class="navBarCell1Rev">Class</li>
<li><a href="package-tree.html">Tree</a></li>
<li><a href="../../deprecated-list.html">Deprecated</a></li>
<li><a href="../../index-all.html">Index</a></li>
<li><a href="../../help-doc.html">Help</a></li>
</ul>
</div>
<div class="subNav">
<ul class="navList">
<li><a href="../../javax/jms/JMSConsumer.html" title="interface in javax.jms"><span class="typeNameLink">Prev&nbsp;Class</span></a></li>
<li><a href="../../javax/jms/JMSDestinationDefinition.html" title="annotation in javax.jms"><span class="typeNameLink">Next&nbsp;Class</span></a></li>
</ul>
<ul class="navList">
<li><a href="../../index.html?javax/jms/JMSContext.html" target="_top">Frames</a></li>
<li><a href="JMSContext.html" target="_top">No&nbsp;Frames</a></li>
</ul>
<ul class="navList" id="allclasses_navbar_bottom">
<li><a href="../../allclasses-noframe.html">All&nbsp;Classes</a></li>
</ul>
<div>
<script type="text/javascript"><!--
allClassesLink = document.getElementById("allclasses_navbar_bottom");
if(window==top) {
allClassesLink.style.display = "block";
}
else {
allClassesLink.style.display = "none";
}
//-->
</script>
</div>
<div>
<ul class="subNavList">
<li>Summary:&nbsp;</li>
<li>Nested&nbsp;|&nbsp;</li>
<li><a href="#field.summary">Field</a>&nbsp;|&nbsp;</li>
<li>Constr&nbsp;|&nbsp;</li>
<li><a href="#method.summary">Method</a></li>
</ul>
<ul class="subNavList">
<li>Detail:&nbsp;</li>
<li><a href="#field.detail">Field</a>&nbsp;|&nbsp;</li>
<li>Constr&nbsp;|&nbsp;</li>
<li><a href="#method.detail">Method</a></li>
</ul>
</div>
<a name="skip.navbar.bottom">
<!-- -->
</a></div>
<!-- ======== END OF BOTTOM NAVBAR ======= -->
</body>
</html>