| <!DOCTYPE HTML> |
| <!-- NewPage --> |
| <html lang="en"> |
| <head> |
| <!-- Generated by javadoc --> |
| <title>ClientConsumer (ActiveMQ Artemis Website 2.31.1 API)</title> |
| <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> |
| <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="ClientConsumer (ActiveMQ Artemis Website 2.31.1 API)"; |
| } |
| } |
| catch(err) { |
| } |
| //--> |
| var data = {"i0":6,"i1":6,"i2":6,"i3":6,"i4":6,"i5":6,"i6":6,"i7":6,"i8":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> |
| <header role="banner"> |
| <nav role="navigation"> |
| <div class="fixedNav"> |
| <!-- ========= START OF TOP NAVBAR ======= --> |
| <div class="topNav"><a id="navbar.top"> |
| <!-- --> |
| </a> |
| <div class="skipNav"><a href="#skip.navbar.top" title="Skip navigation links">Skip navigation links</a></div> |
| <a id="navbar.top.firstrow"> |
| <!-- --> |
| </a> |
| <ul class="navList" title="Navigation"> |
| <li><a href="../../../../../../../index.html">Overview</a></li> |
| <li><a href="package-summary.html">Package</a></li> |
| <li class="navBarCell1Rev">Class</li> |
| <li><a href="class-use/ClientConsumer.html">Use</a></li> |
| <li><a href="package-tree.html">Tree</a></li> |
| <li><a href="../../../../../../../deprecated-list.html">Deprecated</a></li> |
| <li><a href="../../../../../../../help-doc.html">Help</a></li> |
| </ul> |
| </div> |
| <div class="subNav"> |
| <ul class="navList" id="allclasses_navbar_top"> |
| <li><a href="../../../../../../../allclasses.html">All 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> |
| <noscript> |
| <div>JavaScript is disabled on your browser.</div> |
| </noscript> |
| </div> |
| <div> |
| <ul class="subNavList"> |
| <li>Summary: </li> |
| <li>Nested | </li> |
| <li>Field | </li> |
| <li>Constr | </li> |
| <li><a href="#method.summary">Method</a></li> |
| </ul> |
| <ul class="subNavList"> |
| <li>Detail: </li> |
| <li>Field | </li> |
| <li>Constr | </li> |
| <li><a href="#method.detail">Method</a></li> |
| </ul> |
| </div> |
| <a id="skip.navbar.top"> |
| <!-- --> |
| </a></div> |
| <!-- ========= END OF TOP NAVBAR ========= --> |
| </div> |
| <div class="navPadding"> </div> |
| <script type="text/javascript"><!-- |
| $('.navPadding').css('padding-top', $('.fixedNav').css("height")); |
| //--> |
| </script> |
| </nav> |
| </header> |
| <!-- ======== START OF CLASS DATA ======== --> |
| <main role="main"> |
| <div class="header"> |
| <div class="subTitle"><span class="packageLabelInType">Package</span> <a href="package-summary.html">org.apache.activemq.artemis.api.core.client</a></div> |
| <h2 title="Interface ClientConsumer" class="title">Interface ClientConsumer</h2> |
| </div> |
| <div class="contentContainer"> |
| <div class="description"> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <dl> |
| <dt>All Superinterfaces:</dt> |
| <dd><code><a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/lang/AutoCloseable.html?is-external=true" title="class or interface in java.lang" class="externalLink">AutoCloseable</a></code></dd> |
| </dl> |
| <hr> |
| <pre>public interface <span class="typeNameLabel">ClientConsumer</span> |
| extends <a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/lang/AutoCloseable.html?is-external=true" title="class or interface in java.lang" class="externalLink">AutoCloseable</a></pre> |
| <div class="block">A ClientConsumer receives messages from ActiveMQ Artemis queues. |
| <br> |
| Messages can be consumed synchronously by using the <code>receive()</code> methods |
| which will block until a message is received (or a timeout expires) or asynchronously |
| by setting a <a href="MessageHandler.html" title="interface in org.apache.activemq.artemis.api.core.client"><code>MessageHandler</code></a>. |
| <br> |
| These 2 types of consumption are exclusive: a ClientConsumer with a MessageHandler set will |
| throw ActiveMQException if its <code>receive()</code> methods are called.</div> |
| <dl> |
| <dt><span class="seeLabel">See Also:</span></dt> |
| <dd><a href="ClientSession.html#createConsumer(java.lang.String)"><code>ClientSession.createConsumer(String)</code></a></dd> |
| </dl> |
| </li> |
| </ul> |
| </div> |
| <div class="summary"> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <!-- ========== METHOD SUMMARY =========== --> |
| <section role="region"> |
| <ul class="blockList"> |
| <li class="blockList"><a id="method.summary"> |
| <!-- --> |
| </a> |
| <h3>Method Summary</h3> |
| <table class="memberSummary"> |
| <caption><span id="t0" class="activeTableTab"><span>All Methods</span><span class="tabEnd"> </span></span><span id="t2" class="tableTab"><span><a href="javascript:show(2);">Instance Methods</a></span><span class="tabEnd"> </span></span><span id="t3" class="tableTab"><span><a href="javascript:show(4);">Abstract Methods</a></span><span class="tabEnd"> </span></span></caption> |
| <tr> |
| <th class="colFirst" scope="col">Modifier and Type</th> |
| <th class="colSecond" scope="col">Method</th> |
| <th class="colLast" scope="col">Description</th> |
| </tr> |
| <tr id="i0" class="altColor"> |
| <td class="colFirst"><code>void</code></td> |
| <th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#close()">close</a></span>()</code></th> |
| <td class="colLast"> |
| <div class="block">Closes the consumer.</div> |
| </td> |
| </tr> |
| <tr id="i1" class="rowColor"> |
| <td class="colFirst"><code><a href="../../../spi/core/remoting/ConsumerContext.html" title="class in org.apache.activemq.artemis.spi.core.remoting">ConsumerContext</a></code></td> |
| <th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#getConsumerContext()">getConsumerContext</a></span>()</code></th> |
| <td class="colLast"> |
| <div class="block">The server's ID associated with this consumer.</div> |
| </td> |
| </tr> |
| <tr id="i2" class="altColor"> |
| <td class="colFirst"><code><a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/lang/Exception.html?is-external=true" title="class or interface in java.lang" class="externalLink">Exception</a></code></td> |
| <th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#getLastException()">getLastException</a></span>()</code></th> |
| <td class="colLast"> |
| <div class="block">Returns the last exception thrown by a call to this consumer's MessageHandler.</div> |
| </td> |
| </tr> |
| <tr id="i3" class="rowColor"> |
| <td class="colFirst"><code><a href="MessageHandler.html" title="interface in org.apache.activemq.artemis.api.core.client">MessageHandler</a></code></td> |
| <th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#getMessageHandler()">getMessageHandler</a></span>()</code></th> |
| <td class="colLast"> |
| <div class="block">Returns the MessageHandler associated to this consumer.</div> |
| </td> |
| </tr> |
| <tr id="i4" class="altColor"> |
| <td class="colFirst"><code>boolean</code></td> |
| <th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#isClosed()">isClosed</a></span>()</code></th> |
| <td class="colLast"> |
| <div class="block">Returns whether the consumer is closed or not.</div> |
| </td> |
| </tr> |
| <tr id="i5" class="rowColor"> |
| <td class="colFirst"><code><a href="ClientMessage.html" title="interface in org.apache.activemq.artemis.api.core.client">ClientMessage</a></code></td> |
| <th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#receive()">receive</a></span>()</code></th> |
| <td class="colLast"> |
| <div class="block">Receives a message from a queue.</div> |
| </td> |
| </tr> |
| <tr id="i6" class="altColor"> |
| <td class="colFirst"><code><a href="ClientMessage.html" title="interface in org.apache.activemq.artemis.api.core.client">ClientMessage</a></code></td> |
| <th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#receive(long)">receive</a></span>​(long timeout)</code></th> |
| <td class="colLast"> |
| <div class="block">Receives a message from a queue.</div> |
| </td> |
| </tr> |
| <tr id="i7" class="rowColor"> |
| <td class="colFirst"><code><a href="ClientMessage.html" title="interface in org.apache.activemq.artemis.api.core.client">ClientMessage</a></code></td> |
| <th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#receiveImmediate()">receiveImmediate</a></span>()</code></th> |
| <td class="colLast"> |
| <div class="block">Receives a message from a queue.</div> |
| </td> |
| </tr> |
| <tr id="i8" class="altColor"> |
| <td class="colFirst"><code><a href="ClientConsumer.html" title="interface in org.apache.activemq.artemis.api.core.client">ClientConsumer</a></code></td> |
| <th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#setMessageHandler(org.apache.activemq.artemis.api.core.client.MessageHandler)">setMessageHandler</a></span>​(<a href="MessageHandler.html" title="interface in org.apache.activemq.artemis.api.core.client">MessageHandler</a> handler)</code></th> |
| <td class="colLast"> |
| <div class="block">Sets the MessageHandler for this consumer to consume messages asynchronously.</div> |
| </td> |
| </tr> |
| </table> |
| </li> |
| </ul> |
| </section> |
| </li> |
| </ul> |
| </div> |
| <div class="details"> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <!-- ============ METHOD DETAIL ========== --> |
| <section role="region"> |
| <ul class="blockList"> |
| <li class="blockList"><a id="method.detail"> |
| <!-- --> |
| </a> |
| <h3>Method Detail</h3> |
| <a id="getConsumerContext()"> |
| <!-- --> |
| </a> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <h4>getConsumerContext</h4> |
| <pre class="methodSignature"><a href="../../../spi/core/remoting/ConsumerContext.html" title="class in org.apache.activemq.artemis.spi.core.remoting">ConsumerContext</a> getConsumerContext()</pre> |
| <div class="block">The server's ID associated with this consumer. |
| ActiveMQ Artemis implements this as a long but this could be protocol dependent.</div> |
| <dl> |
| <dt><span class="returnLabel">Returns:</span></dt> |
| </dl> |
| </li> |
| </ul> |
| <a id="receive()"> |
| <!-- --> |
| </a> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <h4>receive</h4> |
| <pre class="methodSignature"><a href="ClientMessage.html" title="interface in org.apache.activemq.artemis.api.core.client">ClientMessage</a> receive() |
| throws <a href="../ActiveMQException.html" title="class in org.apache.activemq.artemis.api.core">ActiveMQException</a></pre> |
| <div class="block">Receives a message from a queue. |
| <p> |
| This call will block indefinitely until a message is received. |
| <p> |
| Calling this method on a closed consumer will throw an ActiveMQException.</div> |
| <dl> |
| <dt><span class="returnLabel">Returns:</span></dt> |
| <dd>a ClientMessage</dd> |
| <dt><span class="throwsLabel">Throws:</span></dt> |
| <dd><code><a href="../ActiveMQException.html" title="class in org.apache.activemq.artemis.api.core">ActiveMQException</a></code> - if an exception occurs while waiting to receive a message</dd> |
| </dl> |
| </li> |
| </ul> |
| <a id="receive(long)"> |
| <!-- --> |
| </a> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <h4>receive</h4> |
| <pre class="methodSignature"><a href="ClientMessage.html" title="interface in org.apache.activemq.artemis.api.core.client">ClientMessage</a> receive​(long timeout) |
| throws <a href="../ActiveMQException.html" title="class in org.apache.activemq.artemis.api.core">ActiveMQException</a></pre> |
| <div class="block">Receives a message from a queue. |
| <p> |
| This call will block until a message is received or the given timeout expires. |
| <p> |
| Calling this method on a closed consumer will throw an ActiveMQException.</div> |
| <dl> |
| <dt><span class="paramLabel">Parameters:</span></dt> |
| <dd><code>timeout</code> - time (in milliseconds) to wait to receive a message</dd> |
| <dt><span class="returnLabel">Returns:</span></dt> |
| <dd>a message or <code>null</code> if the time out expired</dd> |
| <dt><span class="throwsLabel">Throws:</span></dt> |
| <dd><code><a href="../ActiveMQException.html" title="class in org.apache.activemq.artemis.api.core">ActiveMQException</a></code> - if an exception occurs while waiting to receive a message</dd> |
| </dl> |
| </li> |
| </ul> |
| <a id="receiveImmediate()"> |
| <!-- --> |
| </a> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <h4>receiveImmediate</h4> |
| <pre class="methodSignature"><a href="ClientMessage.html" title="interface in org.apache.activemq.artemis.api.core.client">ClientMessage</a> receiveImmediate() |
| throws <a href="../ActiveMQException.html" title="class in org.apache.activemq.artemis.api.core">ActiveMQException</a></pre> |
| <div class="block">Receives a message from a queue. This call will force a network trip to ActiveMQ Artemis server to |
| ensure that there are no messages in the queue which can be delivered to this consumer. |
| <p> |
| This call will never wait indefinitely for a message, it will return <code>null</code> if no |
| messages are available for this consumer. |
| <p> |
| Note however that there is a performance cost as an additional network trip to the server may |
| required to check the queue status. |
| <p> |
| Calling this method on a closed consumer will throw an ActiveMQException.</div> |
| <dl> |
| <dt><span class="returnLabel">Returns:</span></dt> |
| <dd>a message or <code>null</code> if there are no messages in the queue for this consumer</dd> |
| <dt><span class="throwsLabel">Throws:</span></dt> |
| <dd><code><a href="../ActiveMQException.html" title="class in org.apache.activemq.artemis.api.core">ActiveMQException</a></code> - if an exception occurs while waiting to receive a message</dd> |
| </dl> |
| </li> |
| </ul> |
| <a id="getMessageHandler()"> |
| <!-- --> |
| </a> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <h4>getMessageHandler</h4> |
| <pre class="methodSignature"><a href="MessageHandler.html" title="interface in org.apache.activemq.artemis.api.core.client">MessageHandler</a> getMessageHandler() |
| throws <a href="../ActiveMQException.html" title="class in org.apache.activemq.artemis.api.core">ActiveMQException</a></pre> |
| <div class="block">Returns the MessageHandler associated to this consumer. |
| <p> |
| Calling this method on a closed consumer will throw an ActiveMQException.</div> |
| <dl> |
| <dt><span class="returnLabel">Returns:</span></dt> |
| <dd>the MessageHandler associated to this consumer or <code>null</code></dd> |
| <dt><span class="throwsLabel">Throws:</span></dt> |
| <dd><code><a href="../ActiveMQException.html" title="class in org.apache.activemq.artemis.api.core">ActiveMQException</a></code> - if an exception occurs while getting the MessageHandler</dd> |
| </dl> |
| </li> |
| </ul> |
| <a id="setMessageHandler(org.apache.activemq.artemis.api.core.client.MessageHandler)"> |
| <!-- --> |
| </a> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <h4>setMessageHandler</h4> |
| <pre class="methodSignature"><a href="ClientConsumer.html" title="interface in org.apache.activemq.artemis.api.core.client">ClientConsumer</a> setMessageHandler​(<a href="MessageHandler.html" title="interface in org.apache.activemq.artemis.api.core.client">MessageHandler</a> handler) |
| throws <a href="../ActiveMQException.html" title="class in org.apache.activemq.artemis.api.core">ActiveMQException</a></pre> |
| <div class="block">Sets the MessageHandler for this consumer to consume messages asynchronously. |
| <p> |
| Note that setting a handler dedicates the parent session, and its child producers |
| and consumers, to the session-wide handler delivery thread of control. |
| <p> |
| Calling this method on a closed consumer will throw a ActiveMQException.</div> |
| <dl> |
| <dt><span class="paramLabel">Parameters:</span></dt> |
| <dd><code>handler</code> - a MessageHandler</dd> |
| <dt><span class="throwsLabel">Throws:</span></dt> |
| <dd><code><a href="../ActiveMQException.html" title="class in org.apache.activemq.artemis.api.core">ActiveMQException</a></code> - if an exception occurs while setting the MessageHandler</dd> |
| </dl> |
| </li> |
| </ul> |
| <a id="close()"> |
| <!-- --> |
| </a> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <h4>close</h4> |
| <pre class="methodSignature">void close() |
| throws <a href="../ActiveMQException.html" title="class in org.apache.activemq.artemis.api.core">ActiveMQException</a></pre> |
| <div class="block">Closes the consumer. |
| <p> |
| Once this consumer is closed, it can not receive messages, whether synchronously or |
| asynchronously.</div> |
| <dl> |
| <dt><span class="overrideSpecifyLabel">Specified by:</span></dt> |
| <dd><code><a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/lang/AutoCloseable.html?is-external=true#close()" title="class or interface in java.lang" class="externalLink">close</a></code> in interface <code><a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/lang/AutoCloseable.html?is-external=true" title="class or interface in java.lang" class="externalLink">AutoCloseable</a></code></dd> |
| <dt><span class="throwsLabel">Throws:</span></dt> |
| <dd><code><a href="../ActiveMQException.html" title="class in org.apache.activemq.artemis.api.core">ActiveMQException</a></code></dd> |
| </dl> |
| </li> |
| </ul> |
| <a id="isClosed()"> |
| <!-- --> |
| </a> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <h4>isClosed</h4> |
| <pre class="methodSignature">boolean isClosed()</pre> |
| <div class="block">Returns whether the consumer is closed or not.</div> |
| <dl> |
| <dt><span class="returnLabel">Returns:</span></dt> |
| <dd><code>true</code> if this consumer is closed, <code>false</code> else</dd> |
| </dl> |
| </li> |
| </ul> |
| <a id="getLastException()"> |
| <!-- --> |
| </a> |
| <ul class="blockListLast"> |
| <li class="blockList"> |
| <h4>getLastException</h4> |
| <pre class="methodSignature"><a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/lang/Exception.html?is-external=true" title="class or interface in java.lang" class="externalLink">Exception</a> getLastException()</pre> |
| <div class="block">Returns the last exception thrown by a call to this consumer's MessageHandler.</div> |
| <dl> |
| <dt><span class="returnLabel">Returns:</span></dt> |
| <dd>the last exception thrown by a call to this consumer's MessageHandler or <code>null</code></dd> |
| </dl> |
| </li> |
| </ul> |
| </li> |
| </ul> |
| </section> |
| </li> |
| </ul> |
| </div> |
| </div> |
| </main> |
| <!-- ========= END OF CLASS DATA ========= --> |
| <footer role="contentinfo"> |
| <nav role="navigation"> |
| <!-- ======= START OF BOTTOM NAVBAR ====== --> |
| <div class="bottomNav"><a id="navbar.bottom"> |
| <!-- --> |
| </a> |
| <div class="skipNav"><a href="#skip.navbar.bottom" title="Skip navigation links">Skip navigation links</a></div> |
| <a id="navbar.bottom.firstrow"> |
| <!-- --> |
| </a> |
| <ul class="navList" title="Navigation"> |
| <li><a href="../../../../../../../index.html">Overview</a></li> |
| <li><a href="package-summary.html">Package</a></li> |
| <li class="navBarCell1Rev">Class</li> |
| <li><a href="class-use/ClientConsumer.html">Use</a></li> |
| <li><a href="package-tree.html">Tree</a></li> |
| <li><a href="../../../../../../../deprecated-list.html">Deprecated</a></li> |
| <li><a href="../../../../../../../help-doc.html">Help</a></li> |
| </ul> |
| </div> |
| <div class="subNav"> |
| <ul class="navList" id="allclasses_navbar_bottom"> |
| <li><a href="../../../../../../../allclasses.html">All 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> |
| <noscript> |
| <div>JavaScript is disabled on your browser.</div> |
| </noscript> |
| </div> |
| <div> |
| <ul class="subNavList"> |
| <li>Summary: </li> |
| <li>Nested | </li> |
| <li>Field | </li> |
| <li>Constr | </li> |
| <li><a href="#method.summary">Method</a></li> |
| </ul> |
| <ul class="subNavList"> |
| <li>Detail: </li> |
| <li>Field | </li> |
| <li>Constr | </li> |
| <li><a href="#method.detail">Method</a></li> |
| </ul> |
| </div> |
| <a id="skip.navbar.bottom"> |
| <!-- --> |
| </a></div> |
| <!-- ======== END OF BOTTOM NAVBAR ======= --> |
| </nav> |
| <p class="legalCopy"><small>Copyright © 2023 <a href="https://www.apache.org/">The Apache Software Foundation</a>. All rights reserved.</small></p> |
| </footer> |
| </body> |
| </html> |